/ Published in: 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 ;)
Expand |
Embed | Plain Text
CREATE TRIGGER dbo.InsertTriggerOnGUIDYourtable ON dbo.YourTable FOR INSERT AS BEGIN SET NOCOUNT ON SELECT GUIDCol AS '@@GUID' FROM inserted END
You need to login to post a comment.
