Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Posts
    8

    Unanswered: How to capture the error message?

    Is possible to capture the message of error generated in the execution
    of a command SQL?

    Thanks.

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Code:
    DECLARE@Error
    
    ..sql statement
    
    SELECT @Error = @@ERROR
    
    
    SELECT * 
      FROM master..sysmessages
      WHERE error = @Error
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Apr 2004
    Posts
    8
    I thank its reply, but I want to capture the specific message of the error and not it generic message. For example:

    "Cannot insert the value NULL into column 'field1', table 'DB.dbo.Tab'; column does not allow nulls. INSERT fails."

    instead of :

    "Cannot insert the value NULL into column '%.*ls', table '%.*ls'; column does not allow nulls. %ls fails."

    Quote Originally Posted by Brett Kaiser
    Code:
    DECLARE@Error
    
    ..sql statement
    
    SELECT @Error = @@ERROR
    
    
    SELECT * 
      FROM master..sysmessages
      WHERE error = @Error

Posting Permissions

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