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
- SET NOCOUNT ON
- SELECT GUIDCol AS '@@GUID'
- FROM inserted
You need to login to post a comment.