ALTER TABLE tablename ADD column1 int
解决方案 »
- 求sql语句使用not exists
- SQL Server2005 如何为表增加说明,并通过程序获取说明信息
- 存储过程要传入一个参数决定用那个字段排序,但是这个参数可能有几十中,存储过程中怎么实现啊
- 存储过程
- 数据索引可以分离么?
- 谁能帮我设计下数据库。。。。
- 变量代换老出错,请大家帮看看?
- 邹大版主,请问如何实现数据库的自动架设?
- 这样的需求,表结构应该怎样设计,小妹谢谢大哥们!
- (给100分!!!)大家有没有遇到这样的问题,大数据库查询时如果在查询过程中得到当前的数据库操作进度?
- [求助]急急急急~~~SQL中IMGAE类型的问题
- SQL SERVER 2000 ODBC连接问题---在线等
update tbname set id=serial
alter table tbname drop column serial
exec sp_rename 'tbname.id','serial'
比如alter table a alter id int,自增属性不会去掉
通过修改系统表可以做到(此法可能有不可预知的结果,慎之...)
sp_configure 'allow updates', 1
GO
reconfigure with override
GO
update syscolumns set colstat = colstat & 0x0000
where id=object_id('表名') and name='字段名'
GO
sp_configure 'allow updates', 0---------------------------------------------
--折中的办法
alter table a add xxx int
update a set xxx=id
alter table a drop column id
exec sp_rename 'xxx', 'id', 'column'
---------------------------------------------
然后删除id列