I have 2 stored procedures I would like to combine to make one to handle the tasks.
My first SP INSERTs values from one table to another:
My next SP UPDATEs the INSERTed INTO table with the field from the above SP that has a value of NULL inserted as follows:
Basically, what I would like to do is just keep the first SP and instead of INSERTing a value of NULL, I would like to look for it in something like the CASE statement of my second SP.
Any assistance will be greatly appreciated.
My first SP INSERTs values from one table to another:
Code:
INSERT INTO Table_1
SELECT Field_1, Field_2, Field_3, NULL FROM Table_2
WHERE Field_1 NOT IN (SELECT Field_1 FROM Table_1)
AND Field_5 = 4
My next SP UPDATEs the INSERTed INTO table with the field from the above SP that has a value of NULL inserted as follows:
Code:
UPDATE Table_1
SET Field_4 =
CASE
WHEN Field_2 IN (SELECT Field_9 FROM Table_4)
THEN 1
WHEN Field_7 LIKE '%something%' THEN 2
ELSE 3
END
WHERE Field_4 IS NULL
Basically, what I would like to do is just keep the first SP and instead of INSERTing a value of NULL, I would like to look for it in something like the CASE statement of my second SP.
Any assistance will be greatly appreciated.