November 5, 2011 at 6:32 am
Hi,
I need to compare sql table field . if field is not null concatenate 'BY: thenmozhi' , if field is null i need to return empty field ..
how i will write sql query
Thanks
November 5, 2011 at 6:41 am
You cold use the COALESCE function for example:
DECLARE @V VARCHAR(5)
SET @V = NULL
--returns a blank ---returns the asterik
SELECT COALESCE(@v,' '),COALESCE(@v, '*')
A better example:
DECLARE @V VARCHAR(5)
DECLARE @W VARCHAR(5)
SET @W ='B'
SET @V = NULL
SELECT COALESCE(@v,' '),COALESCE(@W, ' ')
November 5, 2011 at 6:57 am
Hi bitbucket,
Thanks a lot... its working...
🙂
November 5, 2011 at 7:09 am
sthenmozhi14 (11/5/2011)
Hi bitbucket,Thanks a lot... its working...
🙂
Your welcome and thanks for letting me know ....
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply