0

Hello,I am making a website in JSP celled employee info system.In this whenever a new emp. registers in the system he is given a unique employee id. Currently in my registration page the employee himself will have to manually enter a unique id.Is there a way in which the unique id is generated serially and dynamically .How to do this.Please help.

3
Contributors
7
Replies
9
Views
6 Years
Discussion Span
Last Post by srinivas88
0

Why you are making more difficult to your self? Why do you not let a user fill in registration form and then on successful submit let him/her know what was auto-generated id in the table?

0

ok.My question will still be the same.How do I generate the unique id.say if 1st user's id is 1001.how do i generate 1002 as soon as a new employee registers and show him that this is his id.

0

When you are declaring your tables you need to use AUTO_INCRMENT for MySQL for example or sequence (seq) for PostgreSQL. You would find similar mechanisms for any database. If you have problem find it, just let us know what DB you are using

0

yeah I just came across that.But in auto increment the values start from 1.Is there a way to change it to make it count from 1001? or maybe ER1001 then ER1002 etc .thanks anyway.

0

Read documentation it does tell you have to set starting value...
As for chance to do combination of character plus number, that is not possible and have to be done programatically, meaning you retrieve ID and prefix it what ever you need and then show it to user

Edited by peter_budo: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.