Click here to Skip to main content
15,899,126 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to set message when we make in stored procedure
Posted
Updated 27-May-16 23:22pm
Comments
CHill60 23-Dec-15 3:48am    
Set a message where?
What have you tried?
Where are you stuck?
deepankarbhatnagar 23-Dec-15 5:00am    
Please elaborate which kind of message you want.. popup or simple display. show your code first.

Very simple.

SQL
DECLARE @message NVARCHAR(MAX)
SELECT @message = 'whatever in the world you want it to be.'
 
Share this answer
 
If you want to display messages from a stored procedure use RAISERROR
SQL
RAISERROR ('Your message', 0, 1) WITH NOWAIT
Quote:
It may be surprising but using RAISERROR doesn't require that there is an error condition. If the severity level given to RAISERROR is 0 through 10 SQL Server treats the RAISERROR as a plain message and not an error at all
Using the NOWAIT option with the SQL Server RAISERROR statement[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900