yzx99

导航

 
如果想让ID也要与源表一样,则要把IDENTITY_INSERT打开。
但以下两句,前面不行,后者可以,原因可能在于:还必须显式地将字段列出
truncate table dorm
go
set IDENTITY_INSERT dorm ON
go
insert into dorm select * from manpower.dbo.dorm
go
insert into dorm(ID,em_code,dorm_code,valid_date,meno)
  select ID,em_code,dorm_code,valid_date,meno from manpower.dbo.dorm
go
set IDENTITY_INSERT dorm OFF
go
posted on 2005-09-20 21:45  yzx99  阅读(185)  评论(0编辑  收藏  举报