日期:2014-05-17 浏览次数:21208 次
if OBJECTPROPERTY(OBJECT_ID(N'dbo.test'), N'IsUserTable') = 1
drop table dbo.test
go
--crate table
create table dbo.test (
Id bigint not null,
data int null)
go
alter table dbo.test with check add
constraint pk_test PRIMARY KEY CLUSTERED
(
Id
)
go
--drop pk
alter table dbo.test
drop constraint pk_test
go
--alter column
alter table dbo.test
alter column Id int not null
go
--add pk
alter table dbo.test with check add
constraint pk_test PRIMARY KEY CLUSTERED
(
Id
)
go