Hi there,
I keep getting the following syntax error when I run the following SQL, what is the correct syntax. I am trying to use a CASE statement with an INSERT SELECT.
Thank you
Incorrect syntax near the keyword 'IS'.
--------------------------------------------------------
BEGIN TRAN
INSERT INTO TABLE1 (COLUMN1,COLUMN2,COLUMN3,COLUMN4)
SELECT VALUE1,
'VALUE2' = CASE type
WHEN VALUE2 IS NULL THEN GETDATE()
ELSE MAX(VALUE2)
END,
, VALUE3
, VALUE4
FROM TABLE2 T2 INNER JOIN TABLE3 T3 ON T2.VALUE = T3.VALUE
GROUP BY VALUE1, VALUE3, VALUE4
ORDER BY VALUE1
ROLLBACK TRAN
I keep getting the following syntax error when I run the following SQL, what is the correct syntax. I am trying to use a CASE statement with an INSERT SELECT.
Thank you
Incorrect syntax near the keyword 'IS'.
--------------------------------------------------------
BEGIN TRAN
INSERT INTO TABLE1 (COLUMN1,COLUMN2,COLUMN3,COLUMN4)
SELECT VALUE1,
'VALUE2' = CASE type
WHEN VALUE2 IS NULL THEN GETDATE()
ELSE MAX(VALUE2)
END,
, VALUE3
, VALUE4
FROM TABLE2 T2 INNER JOIN TABLE3 T3 ON T2.VALUE = T3.VALUE
GROUP BY VALUE1, VALUE3, VALUE4
ORDER BY VALUE1
ROLLBACK TRAN