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
 General SQL Server Forums
 New to SQL Server Programming
 Help Needed on Numbering

Author  Topic 

sol-aero
Starting Member

1 Post

Posted - 2007-09-19 : 04:44:13
Hi All,

I've upsized my database from access to SQL server, now im very new to SQL etc and i've been reding up on sqential numbering etc and my mind is buzzing with ideas. This is my problem.

I have a table and a colum called PIR ID this colum needs to start the numbering at 372 and increment by 1 each time. Now initially this was o.k by using identify. However it's a problem when 2 users open the form in access they are given the same number.

Now my though on this was to initially have a seperate table called new PIRID and hold the next bumber in there, so that a new number is taken from the list and entered into the record on save ( does that make sense) now the code i've got up to so far is that i've created the table and i get stuck from there.

Can anyone help me with the code of format of code i'm meant to be using, i'm under the understanding that to perform this funtion i may have to use a trigger of some sort.

Thanks In advance
Carol

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-09-19 : 04:59:02
In SQL Server, use SCOPE_IDENTITY() in favor of @@IDENTITY.
That will guarantee that each user gets his/her own value from IDENTITY column.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -