Solved

Using LIMIT ms sql

Posted on 2013-11-26
7
174 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

860 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