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.
Author |
Topic |
zaidqis
Yak Posting Veteran
63 Posts |
Posted - 2006-06-14 : 07:41:16
|
hiRAISERROR is used to return message to the caller.how to contain RAISERROR :variable declare @name varchar(50)and string'Welcome'i want to contain the RAISERROR messege 'Welcome' + @name value in the same timeexWelcome Zaidcan give the code to do thisthank you |
|
mr_mist
Grunnio
1870 Posts |
Posted - 2006-06-14 : 07:49:19
|
declare @message varchar (10)set @message = 'Hello %s' declare @yourname varchar (10)set @yourname = 'me'raiserror (@message ,10,1, @yourname)Be aware though that the general usage designed for this statement is not to say hi to the person running the code, but to generate error messages.You might be better off with PRINT, although admittedly RAISERROR has the benefit of being flushed immediately.-------Moo. :) |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-06-14 : 08:52:15
|
http://www.sommarskog.se/error-handling-I.htmlMadhivananFailing to plan is Planning to fail |
 |
|
zaidqis
Yak Posting Veteran
63 Posts |
Posted - 2006-06-14 : 14:25:22
|
thank you all for answer me quote: set @message = 'Hello %s'
why you put %s after Hello ??thank you |
 |
|
mr_mist
Grunnio
1870 Posts |
Posted - 2006-06-15 : 04:16:56
|
It's a formatted string parameter for substitution with the argument.Read the RAISERROR section in books online.-------Moo. :) |
 |
|
|
|
|