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 |
wided
Posting Yak Master
218 Posts |
Posted - 2013-12-12 : 06:40:54
|
HelloI just installed sql2012 and I attached a database that works well on SQL2008R2it worked well except that at the triggers, I have error messages:Here is my code(trigger)ALTER trigger [ dbo]. [ Ti_tuser ] on [ dbo]. [ Tuser ] for insert asbegin declare @ numrows int, @ int numnull , @ errno int, @ errmsg varchar (255) select @ numrows = @ @ rowcount if @ numrows = 0 return if update ( CMATRICULE ) begin select @ numnull = ( select count (*) from inserted Where CMATRICULE is null ) if @ numnull ! = @ numrows if (select count (*) TEMPLOYE from t1, t2 inserted Where t1.CMATRICULE = t2.CMATRICULE ) numrows = @ - @ numnull begin select @ errno = 30002 , @ errmsg = ' code ' TEMPLOYE " unknown. Creation of " Tuser " prohibited. " goto error end end return/ * Error handling * /error: raiserror @ errno @ errmsg rollback transactionendThe error message isMsg 102, Level 15 , State 1 ? , ti_tuser Procedure , Line 37Incorrect syntax near ' @ errno .Thank you for helping me because it tye code is everywhere in my database |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
|
|
|
|