[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 197
  • Last Modified:

Using LIMIT ms sql

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
team2005
Asked:
team2005
  • 3
  • 2
  • 2
1 Solution
 
Anthony PerkinsCommented:
What version of SQL Server are you using?  The T-SQL will vary depending on the version.
0
 
SharathData EngineerCommented:
$sql = $sql." ORDER BY ControlID OFFSET {$offset} ROWS FETCH FIRST {$rec_limit} ONLY";
0
 
team2005Author Commented:
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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
SharathData EngineerCommented:
As asked by acperkins, let us know your SQL Server version.
0
 
team2005Author Commented:
SQL versjon is 2012
0
 
Anthony PerkinsCommented:
If it really is SQL Server 2012 then what is the Compatibility Level for this database?
0
 
team2005Author Commented:
you give me olmost the solution
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now