sql - Try-Catch Error Message Foreign Key Constraint -
After
I am trying to write a question that instead of error:
insert Confessional statement with foreign key constraint ... `
My own error might be something like this:
& lt; Value> & lt; TABLE_NAME>
Test Table1: Test table 2 Col1 p tinyint Col2 p tinyint Col2 FK tinyint
I have a test Created the following triggers in the form:
create TRIGGER [dbo]. [CHECK_INSERT] TINYINT declared as TINYINT as Insert in Table1 for Insert TINYINT declared as @ col2 TINYINT selection @loop = min (col1) in the form @loop declaration included in the selection @ col1 = col1 Where Col1 = where col1 = @loop selection @loop @ col2 = col2 is not present and ERROR_NUMBER ((@ col2 col2 to table2 ou select col2 =)) = 547 RAISERROR start ('% s table2', 16, 1 does not exist, cast (@ col2 as VARCHAR (3)) ROLLBACK TRANSACTION END END
I can handle this error Thank you.
After
You can add the statement in the try / catch, but I think that First trigger instead of the need to insert you.
Comments
Post a Comment