Avoiding deadlocks using new READ_COMMITED_SNAPSHOT isolation level in SQL 2005

Programmer A: There’s a deadlock happening when this procedure is run ProgrammerB: Did you try using NOLOCK hint in SELECT statements? It should prevent most deadlocks from happening … How many times have we heard the above type of conversation…

Importance of specifying length in datatypes

This post is just to emphasize on importance in specifying length while declaring fields,variables or parameters. I have seen quite a few occasions where developers have ignored length part. The problem is depicted below select CAST(‘12.34354’ as numeric) ————————————— 12…

Find out particular occurance of weekday in a month

The following function returns the Nth occurance of week day in a month IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME =’GetNthWeekday’ AND ROUTINE_SCHEMA = ‘dbo’ AND ROUTINE_TYPE=’FUNCTION’)DROP FUNCTION dbo.GetNthWeekdayGOCREATE FUNCTION dbo.GetNthWeekday(@date datetime,–Any date of month under consideration@N int,– Nth…