开发者

Get value inserted in RowGuid?

i have a simple tab开发者_开发百科le "MyTable" with single colum "id" which type is uniqueidetifier and rowguid is set to true. I insert new values like this

INSERT INTO MyTable
DEFAULT VALUES

how to get inserted by server guid ?

Best Regards,

Iordan


Assuming you are on at least SQL Server 2005 use the OUTPUT clause.

DECLARE @MyTable TABLE 
(
id UNIQUEIDENTIFIER DEFAULT NEWID()
)

INSERT INTO @MyTable
OUTPUT inserted.id
DEFAULT VALUES
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜