Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Generating unique id numbers
Message
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Title:
Generating unique id numbers
Miscellaneous
Thread ID:
00404882
Message ID:
00404882
Views:
39
Hi:

I'm using the following code fragment in an SP to generate unique case id numbers:

update Counters set nxtcaseno = nxtcaseno + 1
set @retval = (select nxtcaseno from Counters)

I've used code similiar to this in FoxPro for a long time without ever getting a duplicate. However, I'm using it in SQL Server for the first and wonder if it is safe enough? Should I wrap this into a manual transaction or is the implicit transaction good enough?

Thanx,
Charlie
Next
Reply
Map
View

Click here to load this message in the networking platform