1. Add an Identity Column to the Table alter table MASTER add identity_col int identity(1,1); 2. Delete duplicate data using Below Query (In the GROUP BY CLAUSE you can specify multiple columns if the row is indetified using more than one field) delete from MASTER where identity_col not in ( select Min(identity_col) from MASTER group … Continue reading Delete Duplicate Rows SQL Server
Rows
Delete Large Number of Rows SQL Server
To delete rows without locking a table which has say more than 100 million rows to be deleted. Or a large table with archived data has to be deleted. You can use the below function to do this deletion.
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) ;