I would like to write an IN statement when setting the RECEIPTIDS
variable, so that I can pass multiple values in that format into my query. I have tried the following:
DECLARE @RECEIPTIDS VARCHAR(2000)
SET @RECEIPTIDS = ('R00013','R00028')
However, I get the error:
Incorrect syntax near ','.
Use temporary array or temporary List
Didn't work for me either but this did:
You need extra single qoutes.
Edited: Use it with Dynamic query.
You need table variable or temp table.
You can use it in IN as