Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mtorbin
Starting Member
2 Posts |
Posted - 2007-02-28 : 14:41:06
|
| Hey all,I know very simple SQL queries but I need help with this one. I have multiple lines in a SQL database that I need to run. Basically, I need to run this (the bracketed text and the XXX are place holders):DELETE FROM [tableName] WHERE [columnName] = 'XXXXX'But I need to run it around 90 times where XXXXX is a unique variable each time. I could create 90 lines similar to this one but that would take way too much time to run. Any suggestions for a noob?Thanks, - MT-=<>=-=<>=-=<>=-=<>=-=<>=-Matt TorbinPresidentCenter City Philadelphia Macintosh Users Grouphttp://www.ccpmug.org/ |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-02-28 : 14:43:59
|
| Is this any good?DELETE FROM [tableName] WHERE [columnName] IN ('XXXXX', 'YYYYYY', ...)The alternative is to put all the values for [columnName] in a separate table, and JOIN to it - in order to identify the rows to be deletedKristen |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
|
|
mtorbin
Starting Member
2 Posts |
Posted - 2007-02-28 : 15:28:55
|
quote: Originally posted by Kristen Is this any good?DELETE FROM [tableName] WHERE [columnName] IN ('XXXXX', 'YYYYYY', ...)The alternative is to put all the values for [columnName] in a separate table, and JOIN to it - in order to identify the rows to be deletedKristen
That's exactly what I wanted. To answer the other question, the values are given to me from an assistant. They are things that would have to be found by hand. Thanks for the quick reply. - MT-=<>=-=<>=-=<>=-=<>=-=<>=-Matt TorbinPresidentCenter City Philadelphia Macintosh Users Grouphttp://www.ccpmug.org/ |
 |
|
|
|
|
|