Rebuild indexes SQL Server 2000

Lets say you want to rebuild indexes for a particular table in SQL Server 2000. Then you can generate the script to rebuild the indexes using the below command in Query Analyzer. Where xxx is the name of the database who indexes you want to rebuildSELECT 'dbcc dbreindex(''xxx.DBO.' +name+ ''')' FROM sysobjects WHERE xtype='U' 

Remove Null Rows SQL Server

DELETE FROM TABLENAME WHERE (COLUMN_NAME IS NULL OR COLUMN_NAME = 0); If you have additional columns containing NULL values and you want to refine your delete criteria DELETE FROM TABLENAME WHERE (COLUMN_NAME IS NULL OR COLUMN_NAME = 0) AND (COLUMN_NAME_1 IS NULL OR COLUMN_NAME_1 = 0) AND (COLUMN_NAME_2 IS NULL OR COLUMN_NAME_2 = 0) ;

Create Snapshot on Mirror Database SQL Server 2008

Create snapshot on mirror database Sql Server 2008 -- Run below command to find logical filename of database against which you creating a mirror select name, type_desc, physical_name from sys.master_files where database_id = db_id('QIIB_MSCRM') mscrm ROWS C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\QIIB_MSCRM.mdf mscrm_log LOG C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\QIIB_MSCRM_log.LDF -- mscrm is name of file. Now go ahead … Continue reading Create Snapshot on Mirror Database SQL Server 2008