Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is INLIST() in SQL Server optimized?
Message
De
16/05/2008 06:38:27
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01316947
Message ID:
01317570
Vues:
13
>Good morning,
>
>Using SPT from VFP 9 I need to retrieve a bunch of records from a table in SQL Server. The know information is a key field values for each of the records. So I am thinking of building an expressing that will use INLIST() as following:
>
>
>cSqlCommand = "select * from mytable where
>inlist( keyfldname, 'val1', 'val2', 'val3 )"
>
>
>I have 2 questions:
>
>1. VFP help says that the number of INLIST expressions can be up to 25. Is this the same in SQL Server?
>
>2. In VFP INLIST() is Rushmore optimized. Is this the same in SQL Server (if index on KEYFLDNAME exist)?
>
>Thank you in advance for your help.

1) Do not use inlist() bu in ().
2) Unlike VFP you can send very long lists.
3) As list size increases it gets slower (SQL server needs to consume a larger input)
4) An alternative is to create a temp table on the same connection and insert values in that table then use a join (or in (select ... )). This approach works better if you are using the same query for both VFP and SQL.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform