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 |
|
ddobbertin
Yak Posting Veteran
51 Posts |
Posted - 2009-12-04 : 14:38:15
|
| I have a table that has around 30 million records in it, the field is an 18 character char field. My users would like to ability to query up to 500 items against this list. Trying to figure out the best way query such a large # of items against such a large table without losing performance either server or user side. Any help is appreciated. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
ddobbertin
Yak Posting Veteran
51 Posts |
Posted - 2009-12-04 : 14:41:11
|
| Thanks.....any examples how how to loop through that? I was thinking this should probably be a stored procedure? |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
ddobbertin
Yak Posting Veteran
51 Posts |
Posted - 2009-12-04 : 15:51:57
|
| Ok....I didn't explain the issue correctly.....My users have around 500 items in a list and now they query each item against the table one at a time which is very time consuming. They want to be able to take the entire list of 500 items and see which items exist in the table of 30 million records using one query. Basically instead of performing the query 500 times they want to query once. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
ddobbertin
Yak Posting Veteran
51 Posts |
Posted - 2009-12-04 : 16:03:33
|
| I've used IN many times before....however never with a CSV list? Could you help out with an example? I appreciate all the help! |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-12-07 : 03:09:35
|
quote: Originally posted by ddobbertin I've used IN many times before....however never with a CSV list? Could you help out with an example? I appreciate all the help!
Make sure you read all the options specifiedhttp://www.sommarskog.se/arrays-in-sql-2005.htmlMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|