View Single Post
  #1 (permalink)  
Old January 12th, 2007, 05:43 AM
happygv happygv is offline
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default Capture Sql server Error

Hi,

Has anyone tried to capture the error that SQL server throws when an sql statement results error. I know DBCC OUTPUTBUFFER holds the error in hexadecimals. But I wanted to know if anyone ever succeeded on interpretting the outputbuffer and capture the exact error that sql server returns.

Eg:
Code:
create table tbltest ( col1 int )
go

Insert tbltest values ('1abc')
The above insert statement results int he following error.
Code:
Server: Msg 245, Level 16, State 1, Line 1
Syntax error converting the varchar value '1abc' to a column of data type int.
Here... I wish to capture
Syntax error converting the varchar value '1abc' to a column of data type int. This is what being returned by DBCC OUTPUTBUFFER as hexadecimal values.

Hope that explains.
Cheers.

_________________________
- Vijay G
Strive for Perfection
__________________
- Vijay G
Reply With Quote