SQL Server 在现有表上添加自增列
来源:互联网 发布:java编程思想 mobi 编辑:程序博客网 时间:2024/05/16 19:05
--将数据复制到临时表
select * into #aclist from aclist
--删除数据表
drop table aclist
--创建数据表(并设置标识列)
create table aclist(id int identity(1,1),[date] datetime,version nvarchar(6),[class] nvarchar(10),actitle nvarchar(50),acdetail nvarchar(max),author nvarchar(50))
--设置标识列允许插入
set identity_insert aclist on
--将数据从临时表转移过来
insert into aclist(id,[date],version,[class],actitle,acdetail,author)
select id,[date],version,[class],actitle,acdetail,author from #aclist
--关闭标识列插入
set identity_insert aclist off
select * into #aclist from aclist
--删除数据表
drop table aclist
--创建数据表(并设置标识列)
create table aclist(id int identity(1,1),[date] datetime,version nvarchar(6),[class] nvarchar(10),actitle nvarchar(50),acdetail nvarchar(max),author nvarchar(50))
--设置标识列允许插入
set identity_insert aclist on
--将数据从临时表转移过来
insert into aclist(id,[date],version,[class],actitle,acdetail,author)
select id,[date],version,[class],actitle,acdetail,author from #aclist
--关闭标识列插入
set identity_insert aclist off
--强制设置标识列的起始值:
DBCC CHECKIDENT (表名, RESEED, 1) --强制使标识值从1开始.
- SQL Server 在现有表上添加自增列
- SQL Server 2008怎样添加自增列
- 向SQL Server中的现有表中添加具有默认值的列
- sql server 自增列
- SQL Server 自增列
- SQL Server中为现有的列添加或去掉标识属性【转】
- SQL Server中为现有的列添加或去掉标识属性【转】
- SQL Server中为现有的列添加或去掉标识属性
- SQL Server中为现有的列添加或去掉标识(Identity)属性
- sql server 2012 报表开发(3) Reporting Service 如何在数据列上添加超链接跳转
- sql语句查询添加自增列
- Sql server中,怎么样自增列
- 关于SQL SERVER自增列
- Sql Server 自增列应用
- SQL server 创建自增列
- SQL Server 无法设置自增列?
- SQL在现有表中添加新字段
- 如何快速给现有表添加一个自增字段
- 容器的注意事项
- 经常遇到string和date之间的转换
- oracle分析函数系列之first_value/last_value:在记录集中查找第一条记录和最后一条记录
- IT行业吸引人的十大原因:薪酬高位居第一
- Dreamweaver快捷键 大全
- SQL Server 在现有表上添加自增列
- WWDC 2012 有哪些亮点
- Linux系统管理命令之屌丝与高富帅
- JNDI在tomcat中的应用:配置数据源
- libnids分析(3)
- Linux清空内存和磁盘缓存
- String 的 compareTo 方法
- RedHat5.3上安装oracle10g(整理)
- 顺序结构的规范