简体   繁体   中英

Msg 156, Level 15, State 1, Procedure CLR_TRIGGER_NAUDOJASI, Line 1 Incorrect syntax near the keyword 'insert'

So I generated a .sql file from my physical data model which is created with Sybase PowerDesigner. And then I'm trying to execute that .sql in Microsoft SQL Server, I get an error:

Msg 156, Level 15, State 1, Procedure CLR_TRIGGER_NAUDOJASI, Line 1
Incorrect syntax near the keyword 'insert'.

In these lines of code (insert, as and Assembly is underlined)

create trigger CLR_TRIGGER_NAUDOJASI 
on NAUDOJASI  insert as
   external name %Assembly.GeneratedName%.
go

Any help will be appreciated.

You simply forgot the FOR (or AFTER ) keyword before the INSERT :

CREATE TRIGGER CLR_TRIGGER_NAUDOJASI 
ON dbo.NAUDOJASI  
FOR INSERT 
AS 
   external name %Assembly.GeneratedName%.
go

Before asking such a question, you should really consult the SQL Server Books Online on MSDN first! The have the precise syntax for any of the T-SQL commands for you verify!

Make sure that you have specified Microsoft SQL Server as the Target DMBS in the PowerDesigner. The syntax doesn't look like that for Microsoft T-SQL, it's probably the Sybase version (which is the default setting in PD).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM