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

LVL 2
team2005Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
SharathConnect With a Mentor Data EngineerCommented:
$sql = $sql." ORDER BY ControlID OFFSET {$offset} ROWS FETCH FIRST {$rec_limit} ONLY";
0
 
Anthony PerkinsCommented:
What version of SQL Server are you using?  The T-SQL will vary depending on the version.
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
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.