Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
lakshmanjoyforever
Starting Member
1 Post |
Posted - 2012-07-11 : 00:36:45
|
| How to get limited record in sql as ” limit ” in Mysql?We are having the limit keyword in mysql so that we can limit the data so that we can improve the performance of the application.Check the below link for the solutionhttp://lakshmannuli.wordpress.com/2012/07/09/how-can-to-get-limited-record-in-sql-as-limit-in-mysql-14/ |
|
|
lionofdezert
Aged Yak Warrior
885 Posts |
Posted - 2012-07-11 : 02:54:05
|
| SQL Server 2012 provides more better solutionSELECT *FROM MyTableORDER BY TableColumnFETCH NEXT 10 ROWS ONLY; In prior vesions, you can use CTE (Common Table Expression) to achive this functionality.;WITH CTE (SELECT *, ROW_NUMBER() OVER (ORDER BY TableColumn)AS RowNum FROM MyTable)SELECT * FROM CTE WHWERE RowNum >=1 and RowNum<=11--------------------------http://connectsql.com/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2012-07-11 : 08:56:52
|
quote: Originally posted by lionofdezert SQL Server 2012 provides more better solutionSELECT *FROM MyTableORDER BY TableColumnFETCH NEXT 10 ROWS ONLY; In prior vesions, you can use CTE (Common Table Expression) to achive this functionality.;WITH CTE (SELECT *, ROW_NUMBER() OVER (ORDER BY TableColumn)AS RowNum FROM MyTable)SELECT * FROM CTE WHWERE RowNum >=1 and RowNum<=11--------------------------http://connectsql.com/
You need OFFSET tooMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|