mssql query modification

Last Post 17 Apr 2009 01:14 PM by SwePeso. 1 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
vinay789
New Member
New Member

--
17 Apr 2009 03:34 AM
Hi
i am a newbie to mssql i am generating birt reports in table. state is one of the fieldname of my table. state contains null values along with that some strings. But i dont want this null values in the table to display in the place of null values i want to give one common string value so i changed the select statement as follows SELECT advid ,country,ISNULL('all',STATE ) FROM T1
but i noticed that whole state values has been changed to string 'all' but i want only null values to change.wat can i do reply me
Thanx.
SwePeso
New Member
New Member

--
17 Apr 2009 01:14 PM
I think you should use COALESCE in favor of ISNULL.
See this example

DECLARE @vc VARCHAR(4)

SET @vc = 'Peso'
SELECT ISNULL(@vc, 'EVERYTHING')

SET @vc = NULL
SELECT ISNULL(@vc, 'EVERYTHING')

SET @vc = NULL
SELECT COALESCE(@vc, 'EVERYTHING')
You are not authorized to post a reply.

Acceptable Use Policy