开发者

Title: Multipart identifier s.Company_id could not be bound

I am getting the following error while executing the query . Please help

Multipart identifier s.Company_id could not be bound

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 )


Are you sure this variable syntax is correct @current_client_id:int I've never seen @var:type used before and my SQL Server doesn't seem to like it.


Does the table Company have the field named Company_ID?
I guess thats where it should begin. If the field exists, have you spelt it correctly?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜