How to pull values from Excel into a comma separated list to use in a SQL update statement
Posted on 2011-09-07
I have a spreadsheet that basically has a bunch of primary key ids that I asked a co-worker to put together. I can run a simple update statement in SQL Server to update the status of all of these records but I need to get the values into a comma separated list to use for the "IN ()" clause.
Is there a way to auto generate a list (1,2,3,4) from an Excel spreadsheet. The Spreadsheet has one column of numbers and a 2nd column of different primary keys but that column also has some blank columns.
I have tried saving as a CSV but it still opens in Excel and I'm not sure how to grab a simple value list.
Thanks in advance for any tips!