chobo
chobo

Reputation: 4862

How to convert mysql query into SQL Server query?

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?

Upvotes: 0

Views: 624

Answers (3)

Ravi Singh
Ravi Singh

Reputation: 2080

select * from 
(select name , ROW_NUMBER() over(order by name) rn from user ) a
where rn > 5 and rn<= 15

Upvotes: 1

Pandiyan Cool
Pandiyan Cool

Reputation: 6565

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.

Upvotes: 2

Antoniossss
Antoniossss

Reputation: 32517

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

Upvotes: 0

Related Questions