473,385 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to Limit the number of rows returned with MSSQL, like the MySQL Limit clause.

1
hi

I use to work with mysql but now I need mssql. Can somebody tell my how I canwork around LIMIT to select a number of records so I can display 10 records at a time in stead of all?

Thanks
Jul 17 '07 #1
2 3313
mwasif
802 Expert 512MB
I think there is nothing exactly the same as LIMIT. But you can use TOP to get limited records. e.g. TOP 10 will return 10 records but this can not be used like TOP 20,10.

Moreover, you can loop the results to reach to your required result number and start displaying them. But this is not a good approach

I don't know the current implementation of TOP. I read this somewhere.
Jul 17 '07 #2
Atli
5,058 Expert 4TB
I've edited the title of the thread, and moved it to the Sql Server / MSSQL Forums.

Moderator
Jul 19 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Xizor | last post by:
Ok, what I want to do is find out the number of rows in a table. The most obvious solution is to do something like the following: $sql = "SELECT blah FROM blah WHERE 1"; $result =...
3
by: Rainer Collet | last post by:
hi! i tested several php database abstraction layers (db, mdb(2), creole, adodb, etc), but i always missed one really important feature: i need a method for a limited select which gives me the...
1
by: Steve | last post by:
I've run in to a problem with a query I'm trying to write. I have attached a sample SQL script at the end of this post to show an overview of what I'm working with. I want to be able to use...
5
by: Jeremy | last post by:
I am relatively inexperienced with SQL, and I am trying to learn how to analyze some data with it. I have a table with the following information. COMPANY ID , DATE, MarektValue I would like...
2
by: Urban | last post by:
hi, I have a question. Maybe You know the equivalent to command LIMIT from MySQL I couldn`t find something like this in MS SQL PS I try to display 10 records begining form e.g. 4 sort by id...
2
by: Mike | last post by:
New to PHP and MySQL. Using PHP5 and MySQL 4.1 Windows XP Pro IIS 5.1 I'm trying to page a recordset, and am using a LIMIT clause to fetch a defined range of records from my db. However, the...
0
by: D. Dante Lorenso | last post by:
I need to know that original number of rows that WOULD have been returned by a SELECT statement if the LIMIT / OFFSET where not present in the statement. Is there a way to get this data from PG ?...
1
by: C. | last post by:
Hi, First off, apologies for posting here - I can't find a dedicated SQLite newsgroup The other thing I can't find is how to retrieve the total number of rows which would have been returned...
1
by: henryrhenryr | last post by:
Hello! I'm having a bit of trouble with a query. I am trying to paginate a set of results using LIMIT. Each result has a bit of 'basic' data and potentially multiple 'additional' data. I have...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.