Use the code below if you want to restart the id column of a table from 0.
This is most useful if you have cleared a table and want to have the automatic generation of the id field to start at zero again.
| DBCC CHECKIDENT(‘yourTable’, RESEED, 0) ; |
Use the code below if you want to restart the id column of a table from 0.
This is most useful if you have cleared a table and want to have the automatic generation of the id field to start at zero again.
| DBCC CHECKIDENT(‘yourTable’, RESEED, 0) ; |
Exactly what the title says, checks if a column exists and then deletes it.
| IF exists(SELECT id FROM syscolumns WHERE name LIKE ‘yourColumn’) ALTER TABLE yourTable DROP COLUMN yourColumn |
Use to find the day of the week and return an integer.
| SELECT TOP(5) DatePart(WEEKDAY, [EnquiryRaisedDate]) AS ‘DayOfWeek’, [EnquiryRaisedDate] FROM [vEnquiry] |
To find the named day of the week, use:
| SELECT TOP(5) DateName(WEEKDAY, [EnquiryRaisedDate]) AS ‘DayOfWeek’, [EnquiryRaisedDate] FROM [vEnquiry] |
