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
==================================================
我只能上查询分析器,所以只能这么该,对马,系统提示错误,怎么该阿??
==================================================
不能直接修改为标识列:
可以先加新的标识列,再设置允许修改标识列,再用原来的字段值填充标识列,再删除原字段,再对字段改名
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
==================================================
相关文章推荐
- @@IDENTITY 是否总能保证插入语句执行后的ID是正确的?
- [导入]@@IDENTITY 是否总能保证插入语句执行后的ID是正确的?
- [导入]@@IDENTITY 是否总能保证插入语句执行后的ID是正确的?
- MSSQL ALTER TABLE 用语句修改Primary key 的ID
- SQL高级---SQL ALTER TABLE 语句
- MariaDB ALTER TABLE语句
- create [table,column],alter column use SMO
- sql server alter column 由于一个或多个对象访问此列,ALTER TABLE ALTER COLUMN 失败
- 一道Javascript面试题,去除数组中的重复数字,大家看看我的做法是否正确
- mybatis一对一的三种实现方式 数据准备: 使用mysql数据库作为测试。建表语句及测试数据: CREATE TABLE `classes` ( `class_id` int(11) NOT
- ALTER DATABASE 与 ALTER TABLESPACE两类语句的OFFLINE子句的区别
- SQL ALTER TABLE 语句
- Unable to Drop a Datafile From the Tablespace Using Alter Tablespace Command (Doc ID 1050261.1)
- SQL ALTER TABLE 语句
- [C#]C#中验证sql语句是否正确(不执行语句)
- MSSql Server 索引'uq_f_userName' 依赖于 列'f_userName'。由于一个或多个对象访问此列,ALTER TABLE ALTER COLUMN f_userName 失败
- How to alter column to identity(1,1)
- INSERT 语句与 FOREIGN KEY 约束"FK_comment_news"冲突。该冲突发生于数据库"newssystem",表"dbo.news", column 'id'。 语句已终止。
- 1、在控制台使用sql插入语句插入中文时报如下错误: Incorrect string value: '\xD5\xC5\xC8\xFD' for column xxx..//不正确的字符串,属
- 输入年月日,看看格式是否正确。