I have tried to use Case and SET NOEXEC ON but get the following errors:
Syntax Error: unexpected 'SET' (set)
Syntax Error: missing 'closing parenthesis'
INSERT INTO tag (table, repr, tag, value)
SELECT 'product' AS table,
@Id AS repr,
'product_code' AS tag,
CASE @Code
WHEN NOT null THEN @Code
ELSE SET NOEXEC ON
END AS value`
@Id and @Code are declared parameters in the script