Created
June 2, 2017 09:04
-
-
Save davidsheardown/5e4ac28a5ab183e2a1e0f1fca53f8a01 to your computer and use it in GitHub Desktop.
CTE MS SQL Query with Joined Update Statement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare @Sku varchar(100) = 'xyz123456' | |
;WITH CTE (Sku,StockItemId) AS | |
( | |
SELECT | |
Sku, | |
StockItemId | |
FROM | |
table_products | |
WHERE | |
Sku = @Sku | |
) | |
-- Update Sage Product Images: reset Shopify product ID | |
UPDATE | |
ext_si | |
SET | |
ext_si.field_to_set = null | |
FROM | |
table_to_update ext_si | |
INNER JOIN | |
CTE ON ext_si.StockItemId = CTE.StockItemId |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment