问题描述
当我执行此查询时出现错误....
插入到Tbl_Replace_Doc
选择50349 + ROW_NUMBER()结束(按sh.code排序),
sd.C_Code,sd.C_Name,1,sh.grad,sd.C_Qualification,sd.C_Add_1,sd.C_Add_2,sd.C_Add_3,sd.C_Add_4,
sd .C_Pin,sd.C_Phone,sd.C_Fax,sd.C_Category,sd.C_Area_Code,sd.C_Subarea_Code,sd.D_DOB,
sd.D_DOW,sd.C_Email_ID,sd.C_FsCode,GETDATE() ,0,'',null,0,GETDATE(),null,null,
sd.c_region_code,cd.c_div_code,sd.C_Doc_Class,null,null,sd.n_mcino,sd.C_FName, sd.C_LName
来自sht sh
加入Td.C_Code = sh.code上的Tbl_Doc_Stock_Chem_Add_Mst sd
加入Tbl_Cust_Div cd on cd.c_cust_code = sd .C_Code
我在下面提到的错误
Msg 8101 ,Level 16,State 1,Line 1
只有在使用列列表并且IDENTITY_INSERT为ON时才能指定表'Tbl_Replace_Doc'中标识列的显式值
请为此等待解决方案
When iam executing this query am getting error....
insert into Tbl_Replace_Doc
select 50349+ROW_NUMBER() over(order by sh.code) ,
sd.C_Code,sd.C_Name,1,sh.grad,sd.C_Qualification,sd.C_Add_1,sd.C_Add_2,sd.C_Add_3,sd.C_Add_4,
sd.C_Pin,sd.C_Phone,sd.C_Fax,sd.C_Category,sd.C_Area_Code,sd.C_Subarea_Code,sd.D_DOB,
sd.D_DOW,sd.C_Email_ID,sd.C_FsCode,GETDATE(),0,'',null,0,GETDATE(),null,null,
sd.c_region_code,cd.c_div_code,sd.C_Doc_Class,null,null,sd.n_mcino,sd.C_FName,sd.C_LName
from sht sh
join Tbl_Doc_Stock_Chem_Add_Mst sd on sd.C_Code=sh.code
join Tbl_Cust_Div cd on cd.c_cust_code=sd.C_Code
error i have mentioned in below
Msg 8101, Level 16, State 1, Line 1
An explicit value for the identity column in table 'Tbl_Replace_Doc' can only be specified when a column list is used and IDENTITY_INSERT is ON
please give solution for this am waiting
推荐答案
这篇关于什么是身份插入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!