Posts

Showing posts from 2011

Nine Promises Should be taken before choosing software field

1) I have already enjoyed my life in childhood 2) I love tension 3) I don't want to spend time wid my friends 4) I love night duties 5) I love to work on Sundays and holidays 6) I want to take revenge on myself 7) I don't want to get married b4 30 yrs of age 8) I want to study until my death AND FINALLY 9) I don't want hair on my head

SQL Server 2005: ISNULL() function

In MS SQL Server, when a string is concatenated with other string variable whose values is NULL, the result will give NULL. Use ISNULL() function to solve this type of problem. In MS SQL Server, when a string is concatenated with other string variable whose values is NULL, the result is NULL. Consider two strings s1=’Hello’ & s2=NULL. The resultant string s3, where s3 = s1 + s2, will give NULL. Means, whenever you will try to concatenate two columns where either column has value NULL, the result column will show NULL. I searched lots & the better result I found after some RnD is to use the function ‘ISNULL()’. In the given below example, I have taken three string variables @s1, @s2 & @s3. Variable @s1 initialized with ‘Hello’ while @s2 initialized with NULL. After concatenation @s1 & @s2 assigned to @s3 and you can see the result displayed is NULL. declare @s1 varchar(10), @s2 varchar(10), @s3 varchar(20) set @s1 = ('Hello') set @s2 = (NULL) set @s3 = (@s1 +'