I have a table that is unique by primary key, and would like to update select rows by passing in an array.
However, I get the following error when trying to execute the stored procedure:
Incorrect syntax near '@indices'
Sample data:
key | someColumn
----+-----------
1 | data
2 | more data
3 | even more data
Query:
declare @indices nvarchar(max) = [1,2,3,...] -- this set by actually set by API
update thisTable
set someColumn = 'data to update with',
where [i] in @indices;
Where indices = [1,2,3,...]
.
How can I pass in an array of keys to check against to update the table?