楼主是不是这样的意思?? Create table A (ID Int Identity(1,1),Name Varchar(10)) Create table B (ID Int Identity(1,1),Name Varchar(10)) GO Insert B Values('AA') Insert B Values('BB') Insert B Values('CC') Insert B Values('DD') Insert B Values('EE') GO Select * from A Set Identity_Insert A ON Insert A(ID) Select ID from B Set Identity_Insert A OFF GO Select * from A
Set Identity_Insert A ON Insert A(ID,Name) Select ID,Name from B Set Identity_Insert A OFF
这种方式我试过,在sql查询分析器中能实现,但在程序中就报 Set Identity_Insert A ON 错误
set identity_insert tablename onset identity_insert tablename off
40,ff)两天记录。我要把b表导入到a表中,a的id为自增字段
Create table A (ID Int Identity(1,1),Name Varchar(10))
Create table B (ID Int Identity(1,1),Name Varchar(10))
GO
Insert B Values('AA')
Insert B Values('BB')
Insert B Values('CC')
Insert B Values('DD')
Insert B Values('EE')
GO
Select * from A
Set Identity_Insert A ON
Insert A(ID) Select ID from B
Set Identity_Insert A OFF
GO
Select * from A
Insert A(ID,Name) Select ID,Name from B
Set Identity_Insert A OFF
名字都叫自動增長的嗎
怎么能手動和Update呢