July 21, 2003 at 7:48 am
Hi,
I have this problem, I need show data from DB
on HTML page. But in DB I have lot or record,
so for this I need something that return from all select only TOP 100 record.
Is is posible do it withou set in all query
TOP 100 ?
Thanx
July 21, 2003 at 7:58 am
Hi gofrin,
quote:
I have this problem, I need show data from DBon HTML page. But in DB I have lot or record,
so for this I need something that return from all select only TOP 100 record.
Is is posible do it withou set in all query
TOP 100 ?
not sure if I understand.
You need a query for this. Well, in fact only if your table contains more than 100 records.
A query could look like
SELECT TOP 100 * (or field) FROM table ..
table could be a subquery, view or a table, but this is briefly explained in BOL in 'SELECT (described) -> Position 'Transact-SQL Reference'
Cheers,
Frank
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
July 21, 2003 at 9:20 am
I understand, that I can use select TOP 100 * ...
but this filter I need for all query on DB. And I would like found some way where I not need add TOP 100 into each query....
July 22, 2003 at 1:50 am
Hi gofrin,
quote:
I understand, that I can use select TOP 100 * ...but this filter I need for all query on DB. And I would like found some way where I not need add TOP 100 into each query....
unfortunately there isn't such a feature like MySQL's LIMIT command in SQL Server. However, even this you need to put into every query.
So, how do you access your data?
If you are doing this with ADO, maybe you can use the MaxRecords property of the ADO recordset object?
Cheers,
Frank
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
July 22, 2003 at 1:58 am
Hi!
Try the T-SQL command 'SET ROWCOUNT 100' on all your connections and you never get more then 100 rows when doing your SELECTs. Though it still has to be executed somehow...
Regards, Hans!
P.S The ADO MaxRecords might do that implicitly so I guess Frank and me are speaking of the same thing :/
Edited by - hanslindgren on 07/22/2003 02:00:31 AM
July 22, 2003 at 2:00 am
Hi Hans,
quote:
Try the SET ROWCOUNT 100 on all your connections and you never get more then 100 rows when doing your SELECTs
thanks, I know I was missing something
Cheers,
Frank
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
July 22, 2003 at 2:11 am
Thanx exactly this I need
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply