Question : 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

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
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 )

Answer : Multipart identifier s.Company_id could not be bound

Fixed syntax issues:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
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, getdate(), @current_user_id
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
  AND s.Company_id = @Company_id
  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 
              AND    spi.Company_item_id = sisl.Company_item_id
              AND    spi.cdm_owner_id = @current_client_id )
Random Solutions  
 
programming4us programming4us