--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)
时间: 2024-11-08 09:10:12