Delete Duplicate rowsDelete from TableName where ColumnName IN ( Select ColumnName from TableName GROUP BY ColumnName HAVING ( COUNT(ColumnName) > 1 ) )Change a Column name of existing table:Reseed the Identity ColumnDBCC CHECKIDENT (BPOLReceipts, RESEED, 50000)Delete Records from the table within certain rangeDelete from TableName where Id> 2439 and Id< 2485Delete specific multiple recordsdelete from TableName where id in (1, 4, 6, 7)ALTER TABLE table_name ADD column_name column_definition;ALTER TABLE employees ADD last_name VARCHAR(50);Change a column type of the existing table:
ALTER TABLE TableName ALTER COLUMN ColumnName numeric(20, 2)
Drop column from the table
ALTER TABLE TableName Drop column TableName ;
To create Update statement..Update values: To quickly set multiple update values. Copy the items to the excel spreadsheet, then add same items with @ sign to the next column. And use this formula=D5 &"=" &H5Changing the seed on existing table/ Resetting seedDBCC CHECKIDENT ('tablename', RESEED,50000 ) GO
No comments:
Post a Comment