Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to handle return NULL string

Author  Topic 

snow12
Yak Posting Veteran

74 Posts

Posted - 2012-06-27 : 18:03:57
Hello:

I have some procedure return null string.

For example


EXEC sp_Name @name OUT
EXEC sp_list @list OUT


select @message = 'The following students name are: ' + @name + CHAR(13) +
'The following list are : ' + @list


if EXEC sp_Name and sp_list both return the value, the message has content, but if EXEC sp_list @list OUT return null, the whole message is empty.

EXEC sp_Name @name OUT still has value. How to show message which sp_Name has value but sp_list return null

Thank you very much!

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2012-06-27 : 19:16:31
Use ISNULL:
select @message = 'The following students name are: ' + ISNULL(@name,'') + CHAR(13) +
'The following list are : ' + ISNULL(@list,'')

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

snow12
Yak Posting Veteran

74 Posts

Posted - 2012-06-28 : 15:57:44
Thank you very much! You are big helper
Go to Top of Page
   

- Advertisement -