Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-08-25 : 08:15:53
|
| Vasi writes "How to generate custom erro msg.I wish to check in my trigger whether inserted or updated row has unique column value. If not, generate a custom msg and abort trigger without inserting. It tried using RAISERROR and ROLLBACK like this:CREATE TRIGGER on TABLE1upon INSERTASIF EXISTS(select column_ID inserted.column_id =table1.column_id)BEGINRAISERROR (',,,,', 16,1)ROLLBACKEND ELSEBEGIN insert into tabel1.....END-----my client app brings up DB error msg and subsequently a runtime error. I think ROLLBACK is necessary.should I change severity level?I want my code to bring up a custom-error msg and prevent inserting row into the table, when above condition is met." |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|