Showing posts with label inserted. Show all posts
Showing posts with label inserted. Show all posts

Wednesday, March 7, 2012

How is it possible that inserted and deleted are both empty in trigger?

I created manage update trigger to react on one column changes. There is an application which is working with DB, so I don't have access to SQL query which changes this column. In most cases trigger works fine, but in one case when this column changes, trigger is fired and IsUpdatedColumn is true for this column, but both inserted and deleted table are empty, so I can't get new value for this column. Any idea why is it happened? Is any way around?

This column type is uniqueidentifier. Inserted and deleted tables are empty when application is changing value from NULL to not null value, but if I change it myself from Management Studio inserted table contains right values. Most like problem is in query which is changing that value.

I'm doing that on Sql Server 2005.

Triggers are also firing when no rows is affected, it is fired on a per statement basis not per row.

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

Sunday, February 19, 2012

How get the new recorde ID after formview insert

I have formview and want to get uniq id from SQL Server 2005 after it inserted.

I think i should put some code in the event of oniteminserted, anybody have sample code

Thanks

Hu

http://www.davidj.org/stories/162/ASP.NET_Return_Identity_After_SQL_Insert.html