我创建了此查询以填写列RPS
&表Nota_Fiscal
中的ZOH_BLS08_IDL.ID_NFUM
&分别是ZPREFNO
,但是我得到了一个"无法绑定"错误。
insert into [DM_AG_BIZ].[SC].[WEBN_X86_BR_BILLDOC] ([RPS], [Nota_Fiscal])
select [ID_NFNUM], [ZPREFNO]
from [DM_AG_IT].[dbo].[ZOH_BLS08_IDL]
where [DM_AG_BIZ].[SC].[WEBN_X86_BR_BILLDOC].[Bill_Doc] = [DM_AG_IT].[dbo].[ZOH_BLS08_IDL].[BILL_NUM]
答案 0 :(得分:0)
-- Switch to target database context
USE [DM_AG_BIZ];
GO
-- remove database qualifier on target table
-- Also, remove brackets since not required here
INSERT INTO SC.WEBN_X86_BR_BILLDOC (RPS, Nota_Fiscal)
-- use 2-part column names
SELECT src.ID_NFNUM, src.ZPREFNO
-- alias the source table
FROM [DM_AG_IT].[dbo].[ZOH_BLS08_IDL] src
-- join to the target table, and alias that as well
JOIN SC.WEBN_X86_BR_BILLDOC tgt
ON src.Bill_Doc = tgt.BILL_NUM