网络营销电子商务研究中心

网络营销电子商务研究中心 (https://www.0058.net/index.php)
-   建站交流 (https://www.0058.net/forumdisplay.php?f=11)
-   -   用sql语句更改自动编号的字段重新重'1'开始编号 (https://www.0058.net/showthread.php?t=4139)

topvip 2010-07-03 06:36 PM

用sql语句更改自动编号的字段重新重'1'开始编号
 
tableName(id,clcode,cloth) id字段为identity(int,1,1) 重建id
select * into #aa from tableName
truncate table tableName
dbcc checkident(tableName,reseed,0)
set IDENTITY_INSERT ON
insert tableName(clcode,clname) select clcode,clname from #aa
//注意不能选择id列
drop table #aa


All times are GMT +8. The time now is 02:01 AM.

Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.