Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TOP 1 vs TOP 1 PERCENT
Message
From
03/03/2012 12:47:43
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Other
Title:
TOP 1 vs TOP 1 PERCENT
Environment versions
SQL Server:
SQL Server 2008
Miscellaneous
Thread ID:
01537165
Message ID:
01537165
Views:
73
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.
Next
Reply
Map
View

Click here to load this message in the networking platform