sql - Retrieve the latest guid value that is testID -
this question has answer here:
- scope_identity() guids? 5 answers
goal:
retrieve latest guid value in real time after have inserted the value in table
problem:
don't know how it
info:
*you can add new vale address , zip code
*please take account can lots of data!
create table [addressbook] ( [testid] [uniqueidentifier] not null default newid(), [address] [nvarchar](50) null, [zipcode] [nvarchar](50) null )
you can retrieve inserted guid through insert stored procedure sample:
create procedure [dbo].[spupdatebookmark] @bookmarkguid [uniqueidentifier] = null, @otherfield nvarchar(256), @newbookmarkguid [uniqueidentifier] output execute caller begin set @bookmarkguid = newid() insert bookmarks (bookmarkguid, otherfield) values (@bookmarkguid, @otherfield) set @newbookmarkguid = @bookmarkguid end
then when call procedure add parameter output value.
Comments
Post a Comment