您的位置:首页 > 其它

alter table image alter column id int IDENTITY (1, 1) NOT NULL 帮我看看语句是否正确!!

2009-12-03 16:01 323 查看
alter table image alter column id int IDENTITY (1, 1) NOT NULL

我只能上查询分析器,所以只能这么该,对马,系统提示错误,怎么该阿??

==================================================
不能直接修改为标识列:
可以先加新的标识列,再设置允许修改标识列,再用原来的字段值填充标识列,再删除原字段,再对字段改名

ALTER TABLE 表 ADD 编号1 bigint identity(1,1) not null
go
SET IDENTITY_INSERT 表 ON
go
update 表 set 编号1=编号
go
SET IDENTITY_INSERT 表 OFF
go
ALTER TABLE 表 DROP COLUMN 编号
go
exec sp_rename '表.编号1','编号'
go
==================================================
alter table [image] alter column [id] int IDENTITY (1,1) NOT NULL

==================================================
ALTER TABLE 表 ADD 编号1 bigint identity(1,1) not null
go
ALTER TABLE 表 DROP COLUMN 编号
go
exec sp_rename '表.编号1','编号'
go

==================================================
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐