How to capture the error causing column name from an error mesgae 
Author Message
 How to capture the error causing column name from an error mesgae

Hi All,

This is a simple query I have :-

--create table gigen (c1 int, c2 char(30) not null)



insert gigen values(1, null)




The Result is as follows :-

Msg 515, Level 16, State 3
Attempt to insert the value NULL into column 'c2', table 'testdb.dbo.gigen';
column does not allow nulls.  INSERT fails.
Command has been aborted.
(1 row(s) affected)

(1 row(s) affected)
515

----------------

From the error number 515  I can find the error message from sysmessages
system table, but how do I find out that column 'c2'
was the column name in which the null was being inserted (an error because
c2 allows only null.  This will help me point out to the user the exact
problem !!!

Thanks in advance.

Raghu




Tue, 11 Apr 2000 03:00:00 GMT
 
 [ 1 post ] 

 Relevant Pages 

1. Capturing column names and other dynamic data when error occurs

2. CAPTURING EXACT CAUSE OF ERROR

3. strange error need help - Column name appears more than once in resulting column list

4. could not drop column MyColumn from table MyTable Error 207: Invalid Column Name

5. Error Capture On? No capture

6. Capturing Errors using @@ERROR

7. Multi-Instancing naming causing MSG7202 errors

8. how to capture error code and error msg on insert

9. Underscore in Domain Name causing validation errors

10. Unexpected Internal Error - (Caused by Named Set?)

11. Dynamic field name causes error

12. How to Override Error Message (Error Capture Does not Work)


 
Powered by phpBB® Forum Software