Solved

Using LIMIT ms sql

Posted on 2013-11-26
7
172 Views
Last Modified: 2013-12-16
Hi!

Have this line of sql for mysql

How to write this same line using MS SQL ?

$sql = $sql." ORDER BY ControlID LIMIT {$offset}, {$rec_limit}";

Open in new window

0
Comment
Question by:team2005
  • 3
  • 2
  • 2
7 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 39679607
What version of SQL Server are you using?  The T-SQL will vary depending on the version.
0
 
LVL 40

Accepted Solution

by:
Sharath earned 500 total points
ID: 39679611
$sql = $sql." ORDER BY ControlID OFFSET {$offset} ROWS FETCH FIRST {$rec_limit} ONLY";
0
 
LVL 2

Author Comment

by:team2005
ID: 39679949
Hi!

Tryed your code Sharah..

Get this error message

[Microsoft][SQL Server Native Client 11.0][SQL Server]Unclosed quotation mark after the character string ' ORDER BY ControlID OFFSET 0 ROWS FETCH FIRST 10 ONLY'. [message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Unclosed quotation mark after the character string ' ORDER BY ControlID OFFSET 0 ROWS FETCH FIRST 10 ONLY'. ) )
0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
LVL 40

Expert Comment

by:Sharath
ID: 39679955
As asked by acperkins, let us know your SQL Server version.
0
 
LVL 2

Author Comment

by:team2005
ID: 39680096
SQL versjon is 2012
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 39681216
If it really is SQL Server 2012 then what is the Compatibility Level for this database?
0
 
LVL 2

Author Closing Comment

by:team2005
ID: 39721523
you give me olmost the solution
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now