Archive for the Category »MSSQL 2000, 2005, 2008 «

How to repair suspected mssql database

How to repair suspected mssql database-

When  you connect your MSSQL server you may notice some database(s) in ’suspected’ mode and it doesn’t let you do anything. This is happening because of database corruption, server not properly shut down, etc..  To repair the ’suspected’ database you may need to run the following query in your Query Analyzer(for SQL 2000) or Management Studio (for SQL 2005 and 2008)-

EXEC sp_resetstatus databasenamehere;
ALTER DATABASE databasenamehere SET EMERGENCY
DBCC checkdb(databasenamehere)
ALTER DATABASE databasenamehere SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB (databasenamehere, REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE databasenamehere SET MULTI_USER

Note: Before running the query please make sure you have taken the copy of data and transaction log files to another location.

Your database is repaired now

“`*“`arun
VN:F [1.6.7_924]
Rating: 0.0/5 (0 votes cast)
VN:F [1.6.7_924]
Rating: 0 (from 0 votes)
Find the exact version of your MSSQL server

Many people are not sure of how to find the exact version of their MSSQL server. Here’s the query to be run on SQL Query Analyzer or SQL Server Management Studio thro’ new query-

Find out the version of SQL Server 6.5 -

SELECT @@VERSION

Find out the version of SQL Server 7.0 -

SELECT @@VERSION

Find out the version of SQL Server 2000 -

SELECT  SERVERPROPERTY(’productversion’), SERVERPROPERTY (’productlevel’), SERVERPROPERTY (’edition’)

Find out the version of SQL Server 2005 -

SELECT  SERVERPROPERTY(’productversion’), SERVERPROPERTY (’productlevel’), SERVERPROPERTY (’edition’)

Find out the version of SQL Server 2008 -

SELECT SERVERPROPERTY(’productversion’), SERVERPROPERTY (’productlevel’), SERVERPROPERTY (’edition’)

“`*“`arun
VN:F [1.6.7_924]
Rating: 0.0/5 (0 votes cast)
VN:F [1.6.7_924]
Rating: 0 (from 0 votes)