Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 sequences in sql server?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-08-12 : 23:48:37
Monsur writes "Although SQL Server provides identity field funcitonality for creating unique fields, I have yet to discover a way to aggregate fields on a common unique ID. Suppose I store a log of user activity on a website; I want each user's session to be grouped together. Each log entry would be its own row in the table, but there must be some unique ID that groups rows for a particular session. Oracle provides the ability to grab a unique grouping id using their "sequences" functionality; "SELECT sequencename.nextval FROM dual" would give you the next ID in a unqiue series. I have yet to discover similar functionality in SQL server. The best I solution I can see is create a dummy table with a unique ID field; every time a program needs a unique ID, perform an insert on this table and grab the @@Identity value. But this is a slow process. Any better ideas?

thanks,
MH"
   

- Advertisement -