I have a big list of int parameters for a SQL query:
update mytable set col='xyz'
where id in (/* thousands of ints */)
My problem is that in SQL Server 2000 there are a limit for parameters. I could run this query on an SQL Server 2008 too.
What is the better way to do this.
Edit:
The list of Ids come from a C# program. Not from another table.
You can insert the integers into a temp table, and then query like this:
update mytable m set col='xyz'
where exists (select * from #MyTempTable where id = m.id)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With