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.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 error trigger (database sql8 r2, to sql2012)

Author  Topic 

wided
Posting Yak Master

218 Posts

Posted - 2013-12-12 : 06:40:54
Hello

I just installed sql2012 and I attached a database that works well on SQL2008R2

it 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 as
begin
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 transaction
end


The error message is

Msg 102, Level 15 , State 1 ? , ti_tuser Procedure , Line 37
Incorrect 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

Posted - 2013-12-12 : 10:46:00
Duplicate post:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=190249

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -