sql2008 点击表insert时插入其他表数据提示如下错误
代码如下:
INSERT INTO [ExamV2.0].[dbo].[GSys_Doctors]
([CD_SerialCode]
,[CD_DoctorName]
,[CD_Gender]
,[CD_JobTitle]
,[CD_SeniorityCode]
,[CD_PracticeCode]
,[CD_MedicCode]
,[CD_IndentityCode]
,[CD_CatalogCode]
,[CD_State])
VALUES
[cmda_drems].[dbo].[GSys_Doctors]
([CD_SerialCode]
,[CD_DoctorName]
,[CD_Gender]
,[CD_JobTitle]
, '1111111'
,'1111111'
,[CD_MedicCode]
,[CD_IndentityCode]
,[CD_MedicSort]
,'1')
GO
[解决办法]
那就要改成这样
INSERT INTO [ExamV2.0].[dbo].[GSys_Doctors]
( [CD_SerialCode] ,
[CD_DoctorName] ,
[CD_Gender] ,
[CD_JobTitle] ,
[CD_SeniorityCode] ,
[CD_PracticeCode] ,
[CD_MedicCode] ,
[CD_IndentityCode] ,
[CD_CatalogCode] ,
[CD_State]
)
select [CD_SerialCode] ,
[CD_DoctorName] ,
[CD_Gender] ,
[CD_JobTitle] ,
'1111111' ,
'1111111' ,
[CD_MedicCode] ,
[CD_IndentityCode] ,
[CD_MedicSort] ,
'1'
from [cmda_drems].[dbo].[GSys_Doctors]
INSERT INTO [ExamV2.0].[dbo].[GSys_Doctors]
([CD_SerialCode]
,[CD_DoctorName]
,[CD_Gender]
,[CD_JobTitle]
,[CD_SeniorityCode]
,[CD_PracticeCode]
,[CD_MedicCode]
,[CD_IndentityCode]
,[CD_CatalogCode]
,[CD_State])
select [CD_SerialCode]
,[CD_DoctorName]
,[CD_Gender]
,[CD_JobTitle]
,'1111111'
,'1111111'
,[CD_MedicCode]
,[CD_IndentityCode]
,[CD_MedicSort]
,'1'
from [cmda_drems].[dbo].[GSys_Doctors]