SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to handle return NULL string
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

snow12
Yak Posting Veteran

74 Posts

Posted - 06/27/2012 :  18:03:57  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

USA
2868 Posts

Posted - 06/27/2012 :  19:16:31  Show Profile  Reply with Quote
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 - 06/28/2012 :  15:57:44  Show Profile  Reply with Quote
Thank you very much! You are big helper
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.14 seconds. Powered By: Snitz Forums 2000