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
  • 675,133
  • 158
  • 1,253
  • 1,388
chobo
  • 4,672
  • 5
  • 20
  • 31

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
  • 5,804
  • 5
  • 45
  • 80
1
select * from 
(select name , ROW_NUMBER() over(order by name) rn from user ) a
where rn > 5 and rn<= 15
Ravi Singh
  • 1,962
  • 11
  • 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
  • 24,977
  • 3
  • 43
  • 86