INSERT 语句的 select 列表包含的项目少于插入列表(但相同)
The select list for the INSERT statement contains fewer items than the insert list (but is identical)
我正在尝试开发具有以下基本结构的程序:
select a.*
into #temp1
from OPENQUERY(otherDB,'SELECT ... FROM ...')a
INSERT INTO [dbo].[Data]
(....)
select *
from #temp1
DROP TABLE #temp1
OPENQUERY
结果中的列数与 INSERT
列相同
我怎么会发现这个错误:
The select list for the INSERT statement contains fewer items than the insert list. The number of SELECT values must match the number of INSERT columns.
如果您尝试使 select 更具体会怎样?示例:
insert into dbo.data (col1,col2) select col1,col2.....
我正在尝试开发具有以下基本结构的程序:
select a.*
into #temp1
from OPENQUERY(otherDB,'SELECT ... FROM ...')a
INSERT INTO [dbo].[Data]
(....)
select *
from #temp1
DROP TABLE #temp1
OPENQUERY
结果中的列数与 INSERT
列相同
我怎么会发现这个错误:
The select list for the INSERT statement contains fewer items than the insert list. The number of SELECT values must match the number of INSERT columns.
如果您尝试使 select 更具体会怎样?示例:
insert into dbo.data (col1,col2) select col1,col2.....