Insert didn't work in Trigger

Hi i'm tring to execute an Insert and in a Trigger but it didn't work. Somebody can tell me why. Thanks

This is the code :

INSERT into DBName..TableName(Field1, Field2) SELECT i.Field1, Field2 From inserted i

INSERT into DBName..TableName(Field1) SELECT Field1 DBName..TableName WHERE Field1 NOT IN (SELECT Field FROM DBName..TableName)

(The second INSERT it is not execute)

more ▼

asked Jan 15, 2010 at 12:35 PM in Default

user-716 (google) gravatar image

user-716 (google)
1 1 1 1

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

Your second insert is missing the FROM keyword.

more ▼

answered Jan 15, 2010 at 05:52 PM

TG gravatar image

1.8k 1 3

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Jan 15, 2010 at 12:35 PM

Seen: 522 times

Last Updated: Jan 15, 2010 at 12:35 PM