--要插入数据的表,包含一个uniqueidentifier字段
create table tb(nid uniqueidentifier default(newid()), name varchar(32))

--定义一个存储uniqueidentifier的表
declare @tb table(nid uniqueidentifier)

--插入数据,并将uniqueidentifier字段内容存入@tb
insert tb(name)
output inserted.nid into @tb(nid)
values('dobear')

--从@tb中猎取uniqueidentifier字段的值
declare @nid uniqueidentifier
select @nid=nid from @tb

select @nid
/*
203A98E7-2CE6-4893-888C-61AB6150D438
*/

drop table tb

参考链接:http://www.dnbcw.com/biancheng/mssql/hfuc106472.html

相关文章:

  • 2022-12-23
  • 2021-04-26
  • 2021-05-21
  • 2021-08-11
  • 2022-02-14
  • 2022-12-23
  • 2021-06-19
猜你喜欢
  • 2021-08-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案