Click here to Skip to main content
12,758,462 members (31,268 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

3.2K views
Posted 28 Sep 2011

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
Project Lead
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

You may also be interested in...

Pro

Comments and Discussions

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