Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding an alternative to the IDENTITY Function

Status
Not open for further replies.

fostc

Technical User
Nov 19, 2003
3
GB
I've got a Stored Procedure that is working fine using the IDENTITY function, but now need to create a VIEW instead. As I am unable to create temporary tables within the view, is there an alternative function for me to use that does the same as IDENTITY?
 
If you are using SQL2005 or above, take a look at the Row_Number function.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
We're using SQL Server 2000 - any other ideas?
 
no.

Can you explain why you need to use a view instead of a function or stored procedure?

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
There is a larger stored procedure which calls a number of views and I am just replacing one of those. If I am unable to find an alternative then I will have to add my code to this procedure but I would rather keep things consistent as I will have to amend a number of procedures rather than 1 view.

Hope I'm making sense!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top