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.
Author |
Topic |
sagarpbora
Starting Member
12 Posts |
Posted - 2008-04-10 : 11:24:08
|
Hi,I am developing a simulation for employee management system where I am supposed to create an employee ID automatically. I know that we can make employee_id column as auto-increment. But I need fixed length employee id. For example, I need 6 digit long employee ID. So, it should start from 100001 and then autoincrement for each new employee.Can anyone suggest how can I do this?Thanks! |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-04-10 : 11:30:19
|
Then while defining IDENTITY property, set appropriate value for seed.for example to start from 100001,Create Table xx(ID int Identity(100001, 1)...) Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
sagarpbora
Starting Member
12 Posts |
Posted - 2008-04-12 : 19:25:35
|
Thanks for the reply Harsh.I could do it in SQL Server 2000 but I want to do it in MySQL also. I tried making it auto_increment and then set the default value to 100001but it still inserts the records from 1.Do you know how we can do it in MySQL? |
 |
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-04-12 : 19:29:56
|
Better to ask it in MySql forum. |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-04-14 : 05:19:42
|
Post at www.dbforums.com or www.mysql.comMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|