执行查询时出现以下错误。 请帮忙
无法绑定多部分标识符s.Company_id
INSERT INTO Company_Item_Company_List
(
Company_id,
Company_item_id,
client_id,
last_modified_timestamp,
last_modified_user_id
)
SELECT
dcsl.distribution_center_id,
sisl.Company_item_id,
@current_client_id:int,
getdate(),
@current_user_id:int
FROM Company_Item_Company_List AS sisl WITH (NOLOCK)
JOIN Distribution_Center_Company_List AS dcsl WITH (NOLOCK) ON
dcsl.Company_id = sisl.Company_id
JOIN Company AS s WITH (NOLOCK) ON
s.Company_id = sisl.Company_id AND s.distribution_center_flag = 'n' AND s.cdm_owner_id = s.client_id
JOIN Company_Item_Base AS sib WITH (NOLOCK) ON
sib.Company_item_id = sisl.Company_item_id
WHERE sisl.Company_item_id = @Company_item_id:int
AND s.Company_id = @Company_id:int
AND sib.exception_status_code = 'n'
AND NOT EXISTS (SELECT 1
FROM Company_Item_Company_List AS sisl2 WITH (NOLOCK)
WHERE sisl2.Company_item_id = sisl.Company_item_id
AND sisl2.Company_id = dcsl.distribution_center_id)
AND EXISTS ( SELECT 1
FROM Company_packaged_item spi
WHERE spi.Company_id = @Company_id:int
AND spi.Company_item_id = sisl.Company_item_id
AND spi.cdm_owner_id = @current_client_id:int )
答案 0 :(得分:2)
您确定此变量语法是否正确@current_client_id:int
我以前从未见过@var:type
,而我的SQL Server似乎不喜欢它。
答案 1 :(得分:0)
表Company
是否有名为Company_ID
的字段?
我猜那应该从哪里开始。如果该字段存在,您是否拼写正确?