[thelist] sql: read in data and execute a query

Judah McAuley judah at wiredotter.com
Thu Jul 12 18:12:40 CDT 2007


Howdy, I've got a situation I'm a bit unfamiliar with. In the past I've 
used DTS in SqlServer 2000 to export data to a csv file just fine. Now 
I'm faced with something like the opposite. I'm going to get a file with 
a delimited list of ids (comma probably, but I can change it) and then I 
need to run a query that updates the rows matching those ids.

So the query would be something like UPDATE foo SET blah = 1 WHERE 
foo.id IN (ids from csvfile)

What I don't know is how to DTS to read the csv file in, stuff the 
contents in a varible and then put the variable into the query, then 
execute the query.

Any thoughts?

Thanks,
Judah




More information about the thelist mailing list