码迷,mamicode.com
首页 > 其他好文 > 详细

添加主键

时间:2015-11-11 11:21:01      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:

--Add Key

alter table [dbo].[BF2ZFB02]

add IDKeyGUID  uniqueidentifier

 

--Set Key Value

update [BF2ZFB02] set IDKeyGUID =  newid()

 

--Alter Key Not Null

alter table [dbo].[BF2ZFB02]

alter column   IDKeyGUID  uniqueidentifier not null

 

--Alter Key as Primary Key

ALTER TABLE [BF2ZFB02]

ADD CONSTRAINT PK_IDKeyGUID PRIMARY KEY (IDKeyGUID)

添加主键

标签:

原文地址:http://www.cnblogs.com/ifreesoft/p/4955441.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!