SQL插入触发器
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SQL插入触发器相关的知识,希望对你有一定的参考价值。
This trigger returns a resultset that includes last inserted record's guid info (uniqueidentifier)If your column is uniqueidentifier and its default value is newid() , you can't get last record id (guid) with @@identity .
So, I write a trigger on my table to get last record guid info ;)
CREATE TRIGGER dbo.InsertTriggerOnGUIDYourtable ON dbo.YourTable FOR INSERT AS BEGIN SET NOCOUNT ON SELECT GUIDCol AS '@@GUID' FROM inserted END
以上是关于SQL插入触发器的主要内容,如果未能解决你的问题,请参考以下文章