question

Akhilesh avatar image
Akhilesh asked

After inserted Trigger

Hi I have Created After inserted Trigger on [Item] Table.when I inserted record in Item Table trigger working fine but when I inserted 2nd time error generated Duplicat record .I want to know why .when I drop trigger then all working fine .Please give me solution . trigger is given below Create Trigger dbt_RND_NewItem ON [Item] After Insert AS update Item Set Item.[Item Reclass] = 1 from [Item] Item ,Inserted Ins where Item.No_ = Ins.No_ and (Item.No_ like '742%' or Item.No_ like '743%')
trigger
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Akhilesh avatar image
Akhilesh answered
hi , I am using Set NOCount ON in my trigger then problem solved .
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jimsnyder avatar image
jimsnyder answered

@Akhilesh When you set Set Item.[Item Reclass] = 1, you are getting something from a table other than the inserted table. There should be a JOIN to enable that table to be seen.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.