December 17, 2003 at 12:15 pm
In QA, I saw a column on the left to show the record# of each row. Is that possible for me to include this info in my query result set. I'd like to take advantage of this to implement one of my application. Please someone help. Thanks
Minh Vu
December 17, 2003 at 12:23 pm
select IDENTITY(int, 1,1) AS RecNum, * INTO #NewTable from yourtable
select * from #NewTable
December 17, 2003 at 12:42 pm
Thanks very much.
However, it does not return correct record# position as my query return.
Ex. My query's result set like this:
1.A
2.B
3.d
4.f
when I used your statement, my result set become
4.a
3.b
2.f
1.d
How can I work around this, I really want the record# will show correct as my result set above. I'm in dark now.
Minh Vu
December 17, 2003 at 12:56 pm
would an
ORDER BY RecNum
help?
Frank
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
December 17, 2003 at 1:04 pm
Some other options for doing what you want can be found my article posted here:
http://www.sqlservercentral.com/columnists/glarsen/sequentialnumbering.asp
Gregory A. Larsen, DBA
Contributor to 'The Best of SQLServerCentral.com 2002' book. Get a copy here: http:www.sqlservercentral.com/bestof/purchase.asp
Need SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples
Gregory A. Larsen, MVP
December 17, 2003 at 1:07 pm
not at all.
December 17, 2003 at 4:32 pm
I am very appreciate all of your help, special thank to Greg Larson. Reading your article helps me solve the problem. Again, my deepest gratitude.
Minh Vu
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply