list first 10 rows
how do I display the first 10 rows in a large database?
[55 byte] By [
mrgezau] at [2007-11-9 21:07:44]

# 1 Re: list first 10 rows
for SQL Server 6.5:
SET ROWCOUNT 10
select * from youre_table
SET ROWCOUNT 0
--
HTH,
David Satz
Principal Web Engineer
Hyperion Solutions
{ SQL Server 2000 SP2/6.5 SP5a } { Cold Fusion 5 SP1 } { VSS }
(Please reply to group only - emails answered rarely)
--------------------
"Kudel" <webket@polisen.nu> wrote in message news:3cbeba51$1@10.1.10.29...
>
> In sql 7.0 you can use "select top 10 * from youre_table"
>
> this returns the 10 entrys that SQL server thinks is first, but if you
also
> uses a "order by what_ever" you can pick the top 10 you want.
>
> "mrgezau" <mrgezau@optusnet.com.au> wrote:
> >
> >how do I display the first 10 rows in a large database??
# 2 Re: list first 10 rows
In sql 7.0 you can use "select top 10 * from youre_table"
this returns the 10 entrys that SQL server thinks is first, but if you also
uses a "order by what_ever" you can pick the top 10 you want.
"mrgezau" <mrgezau@optusnet.com.au> wrote:
>
>how do I display the first 10 rows in a large database??
Kudel at 2007-11-11 23:56:44 >

# 3 Re: list first 10 rows
"Kudel" <webket@polisen.nu> wrote:
>
>In sql 7.0 you can use "select top 10 * from youre_table"
>
>this returns the 10 entrys that SQL server thinks is first, but if you also
>uses a "order by what_ever" you can pick the top 10 you want.
>
>"mrgezau" <mrgezau@optusnet.com.au> wrote:
>>
>>how do I display the first 10 rows in a large database??
AL at 2007-11-11 23:57:51 >

# 4 Re: list first 10 rows
"Kudel" <webket@polisen.nu> wrote:
>
>In sql 7.0 you can use "select top 10 * from youre_table"
>
>this returns the 10 entrys that SQL server thinks is first, but if you also
>uses a "order by what_ever" you can pick the top 10 you want.
>
>"mrgezau" <mrgezau@optusnet.com.au> wrote:
>>
>>how do I display the first 10 rows in a large database??
Beware of Top clause. Withouth the proper indexes SQL will search/scan the
whole table to meet your selection criteria. Use query Analyzer to show
you the execution plan and then add indexes to avoid table scans.
AL at 2007-11-11 23:58:46 >
