September 30, 2009 at 12:39 am
use [Test3]
GO
create trigger tr on Emp
for update
as
select * from inserted;
when i execute it i am getting this error
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'GO'.
Msg 111, Level 15, State 1, Line 1
'CREATE TRIGGER' must be the first statement in a query batch.
Please help me
Thanks
Mahendra singh rajpurohit
September 30, 2009 at 12:42 am
mahenpali (9/30/2009)
use [Test3]GO
create trigger tr on Emp
for update
as
select * from inserted;
when i execute it i am getting this error
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'GO'.
Msg 111, Level 15, State 1, Line 1
'CREATE TRIGGER' must be the first statement in a query batch.
Please help me
Thanks
Mahendra singh rajpurohit
Self explanatory! Just dont use the USE DB and Go rather just select the database and run the below script:
create trigger tr on Emp
for update
as
select * from inserted;
September 30, 2009 at 2:35 am
Just out of curiosity.....
What are you doing with this trigger by the way..?
September 30, 2009 at 10:41 pm
It should work just fine as a script with the GO provided that GO starts in column 1. You cannot, however, do something of this nature in a stored procedure or dynamic SQL because you cannot use GO in either of those.
--Jeff Moden
Change is inevitable... Change for the better is not.
October 1, 2009 at 1:47 am
I think I came across something alike in the past. It turned out that after GO, newline was encoded 'unix style' with one character only (0x0A) instead of the sequence 0x0A 0x0D. Just out of curiosity, can you open your script in a hex editor and see what is going on?
Regards
Piotr
...and your only reply is slàinte mhath
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply