Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 21st, 2004, 09:08 AM
Registered User
 
Join Date: Mar 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Read Error Message

I would like be able to have a stored procedure save an error message, but I have not been able to determine a way to return the sysmessages text (with the appropriate placeholders defined) in the stored procedure.

Example:

select ... something that causes an error
set @error = @@error

insert into ...... save to my table
  select description from sysmessages

The problem with this is the placeholders are not populated, but this is the information I would like to have. Any suggestions?


 
Old September 21st, 2004, 09:43 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

quote from BOL
Quote:
quote:
@@ERROR is the only part of a Microsoft® SQL Server™ 2000 error available within the batch, stored procedure, or trigger that generated the error. All other parts of the error, such as its severity, state, and message text containing replacement strings such as object names, are returned only to the application in which they can be processed using the API error handling mechanisms
looks like you're out of luck within the stored proc itself...
 
Old September 21st, 2004, 11:02 AM
Registered User
 
Join Date: Mar 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oh well, back to the drawing board.

Thanks for the response.







Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the error message for a 500 server error? chobo2 C# 2005 1 May 4th, 2008 03:11 AM
Read First !! An Important Error Stephen Lam Wrox Book Feedback 1 May 6th, 2005 05:05 PM
Read only Database error larry101 Classic ASP Databases 4 September 11th, 2004 08:41 AM
changing the status of the message (read / unread) neomohlala SQL Server 2000 0 August 13th, 2003 04:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.