0

How to covert mysql query into mssql query?

SELECT name FROM user LIMIT 5, 10

I have known that mssql don't support 'limit'...

But I have to use limit!

How to covert mysql query into SQL Server query?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
chobo
  • 4,830
  • 5
  • 23
  • 36

3 Answers3

2

Try out this

SELECT * FROM ( 
  SELECT *, ROW_NUMBER() OVER (ORDER BY name) as row FROM sys.databases 
 ) a WHERE a.row > 5 and a.row <= 10

You can achieve your concept.

Pandiyan Cool
  • 6,381
  • 8
  • 51
  • 87
1
select * from 
(select name , ROW_NUMBER() over(order by name) rn from user ) a
where rn > 5 and rn<= 15
Ravi Singh
  • 2,042
  • 13
  • 29
0

There is no way to translate this, but there is a bit of workaround here on SO. Check this out.

Community
  • 1
  • 1
Antoniossss
  • 31,590
  • 6
  • 57
  • 99