Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2002
    Posts
    28

    Unanswered: Suppress SQL Error message

    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

  2. #2
    Join Date
    Dec 2001
    Location
    Toronto, Canada
    Posts
    335
    I don't know of anyway to suppress the message. But just a note on this, if you are running the procedure through Query Analyzer, ISQL, OSQL remember these are client utilities written by Microsoft. The developers of these utilities choose to display the messages, if you write your own application these messages can be suppressed by you if you chose not to display them.
    MCDBA

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •