Monthly Archives: December 2009

The day of the week can be retrieved in SQL Server by using the DatePart function. The value returned by function is between 1 (Sunday) and 7 (Saturday). To convert this to a string representing the day of the week, use a CASE statement. Method 1: Create function running following script: CREATE FUNCTION dbo.udf_DayOfWeek(@dtDate DATETIME)… Read Article →

This is a SQL Script that Cleans your Database Records & resets Identity Columns, and it is all in 6 lines! /*Disable Constraints & Triggers*/ exec sp_MSforeachtable ‘ALTER TABLE ? NOCHECK CONSTRAINT ALL’ exec sp_MSforeachtable ‘ALTER TABLE ? DISABLE TRIGGER ALL’ /*Perform delete operation on all table for cleanup*/ exec sp_MSforeachtable ‘DELETE ?’ /*Enable Constraints… Read Article →

Scroll To Top