1.你可將要遞增的字段設為 identity型,如 a int identity(1,1)
2. select identity(int,1,1) as id, 其他字段 ...
into 新表
from 原表
2. select identity(int,1,1) as id, 其他字段 ...
into 新表
from 原表
解决方案 »
- raid1 能否做 ghost?(内详)
- SQLEXPRESS2005还原数据库错误
- ms sql 数字型字符串的ASCII码值最大是多少呢?与字符型字符串的ASCII值有个临界点不?
- 使用SQLDMO恢复数据库 返回 远程主机强迫关闭了一个现有的连接
- 急!急!急!sql 安装问题
- 请问双主键的表插入问题,最后10相送。。。
- sql server2005中的一个问题
- 将 expression 转换为数据类型 int 时出现算术溢出错误。请大神帮忙!
- SQL中CDBVariant值特定类型取出。
- 求一段SQL语句
- 如何在一个存储过程结束时用return返回多个变量?
- 遇到难题!大家来挑战!获胜者拿最高分!满分!
1.创建表时
create table table1(id int identity(1,1),...)
2.或者在已有表中增加id 列
alter table table1 add id int identity(1,1)not null
3.在或者在查询中
select id=identity(int,1,1),* into table2 from table1 where ...