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 |  
                                    | sasan_vmYak Posting Veteran
 
 
                                        51 Posts | 
                                            
                                            |  Posted - 2011-04-12 : 07:06:51 
 |  
                                            | Hello,I need to select many records with this scrip: select * from [MyTable] where [ID_M] in (...,...)sometimes selected records can be more than 100,000 records,selecting such amount of record in above syntax can be support withsql-server 2000 ?Kind Regards,sasan. |  |  
                                    | sunitabeckMaster Smack Fu Yak Hacker
 
 
                                    5155 Posts | 
                                        
                                          |  Posted - 2011-04-12 : 07:26:23 
 |  
                                          | The select statement can return more than 100,000 records without hitting against any SQL Server limits.  Whether you want to retrieve that many records is a business decision that only you can answer - typically client applications do not need that many records.If your question is whether SQL Server can support 100,000 items in the comma-separated list in your SQL statement:I have not tried it and you may not want to either. But from what I am reading here (http://msdn.microsoft.com/en-us/library/ms143432(v=SQL.90).aspx), the maximum allowed length of a SQL statement is 65,536*network packet size at least in SQL 2005. So you may be ok in SQL 2000 as well - but I am speculating. REGARDLESS, that would be a very slow query. You are better off inserting the comma-separated list into a table object and joining against that table.If you do want to use alternate approaches other than a long comma-delimited list, you would find this page very useful: http://www.sommarskog.se/arrays-in-sql-2000.html |  
                                          |  |  |  
                                |  |  |  |