Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suppress error messages from being displayed

Status
Not open for further replies.

vaidyanathanpc

Programmer
Nov 30, 2001
36
0
0
IN
Hi,
I have written a procedure to send mail.

CREATE procedure PCWishes
as
declare @rc int
Begin
exec @rc = master.dbo.xp_sendmail @recipients='Murali_K', @Subject='Service Anniversary!!',@Message='Hello'
if @rc = 1
begin
print 'Error'
end
End


The mail id given in the recepients list is an invalid mail id. When I execute this procedure from the query analyzer, I get the the following error message.

Server: Msg 17921, Level 18, State 1, Line 0
A recipient was specified ambiguously.

Error

In the above error message, I want to suppress the SQL Server error message and display only the error message ("Error") given in the print statement in my stored procedure. How do I do this?

Thanks in advance
P.C. Vaidyanathan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top