Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
TOP 1 vs TOP 1 PERCENT
Message
De
03/03/2012 12:47:43
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Titre:
TOP 1 vs TOP 1 PERCENT
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01537165
Message ID:
01537165
Vues:
72
I have a complex view joining several tables
I don't want the data, just a row that will give me the structure and allow me use the mapping to create a datatable in a dataset.

I've been using this technique for zillions of views, but something about this view is odd and I got the following:


When I run:
SELECT TOP 1 * FROM myview
the server times out.


When I run:
SELECT TOP 1 PERCENT * FROM myview
I get a result in a few milliseconds.


I tried ORDER BY 1 and got the same result

So, of course I used TOP 1 PERCENT

My question is.. does anyone know why there's such a difference between TOP 1 and TOP 1 PERCENT?

Or, is the a better way to get the mapping into a datatable?
Anyone who does not go overboard- deserves to.
Malcolm Forbes, Sr.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform