July 21, 2003 at 6:18 am
Is there a way of creating an identity column, or similar, on a result set?
I have the situation where I am joining, say, two table tables and I want a result set to have an identity column starting at 1 and incrementing for each row so if there are 20 rows in the result set I would have an identity column of 1 thorugh 20.
I can do this by putting the results into a temporary table with an identity column and then selecting the rows from the temporary table but I was hoping that I could do this without a temporary table.
Any suggestions or ideas?
Jeremy
July 21, 2003 at 6:25 am
Hi Jeremy,
quote:
Is there a way of creating an identity column, or similar, on a result set?I have the situation where I am joining, say, two table tables and I want a result set to have an identity column starting at 1 and incrementing for each row so if there are 20 rows in the result set I would have an identity column of 1 thorugh 20.
I can do this by putting the results into a temporary table with an identity column and then selecting the rows from the temporary table but I was hoping that I could do this without a temporary table.
Any suggestions or ideas?
maybe the ideas discussed here will help you
hope the link isn't broken
Cheers,
Frank
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply