Click here to Skip to main content
Click here to Skip to main content
Alternative Tip/Trick

Tagged as

Generate auto row number for a table

, 28 Sep 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
SELECT ROW_NUMBER() OVER(ORDER BY [col_1]) as RowNumber,COUNT([col_1]) OVER () AS RecordCount,* FROM TableName
SELECT ROW_NUMBER() OVER(ORDER BY [col_1]) as RowNumber,
COUNT([col_1]) OVER () AS RecordCount,* FROM TableName

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Mukund Thakker
Technical Lead
India India
Software Developer
MCTS - .NET Framework 4.0, Web Applications
 
Blog : http://thakkermukund.wordpress.com
Twitter@thakkermukund
 
Don't code today, what you can't debug tomorrow!
Everything makes sense in someone's mind
Follow on   Twitter

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141223.1 | Last Updated 28 Sep 2011
Article Copyright 2011 by Mukund Thakker
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid