General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Title:
Generating unique id numbers
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only