Hi,
Can you tell me the best way to get a next unique sequence
integer number which fits in a table. My application supports multi users
and at a single point of time users may add a new row to the table. But it
should fit to generate a unique next available integer value.
For eg: my table contains EMPID int, EMP_Name varchar(50)
EMPID is a primary key.
Can any one suggest me the best way to do it?
Thanks in advance.
VenkatHi,
create table Employees
(
EmpID int identity(1, 1) not null, --this will increment with each
insert by one.
Emp_Name varchar(50)
)
HTH
Peter
"Venkat" <stammana@.palantirsolutions.com> wrote in message
news:eb$gxjFSGHA.4300@.TK2MSFTNGP14.phx.gbl...
> Hi,
>
> Can you tell me the best way to get a next unique sequence
> integer number which fits in a table. My application supports multi users
> and at a single point of time users may add a new row to the table. But it
> should fit to generate a unique next available integer value.
>
> For eg: my table contains EMPID int, EMP_Name varchar(50)
> EMPID is a primary key.
>
> Can any one suggest me the best way to do it?
>
> Thanks in advance.
>
> --
> Venkat
>|||After doing an insert, you can get the most recently inserted id with:
SELECT SCOPE_IDENTITY()|||I would re-think this design. Where is the check digit so I can
validate it? Why is the employee identifer a varying length integer
issued internally where it cannot be verified?|||> Why is the employee identifer a varying length integer
> issued internally where it cannot be verified?
can you suggest a better alternative?
No comments:
Post a Comment