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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Doubt while creating a table

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 Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

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 100001
but it still inserts the records from 1.
Do you know how we can do it in MySQL?
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-04-12 : 19:29:56
Better to ask it in MySql forum.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-04-14 : 05:19:42
Post at www.dbforums.com or www.mysql.com

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -