i have a problem on how to code for automatic generate an employee id whenever i registered an account in my system. i used asp.net as my front end and Sql Server Database 2005 as my back end.. thnx a lot!

Do you plan on generating the next number in a sequence? What's the format of the employee ID that you need?

sql databases can generate the numbers for you, just make one of the columns auto increment.

the format that i want is like this "FHMS120001" . so if ever that the system register another employee the system will automatically generate's another unique number.. "FHMS12002" :] thnx sir.. :]

is the FHMS a static string and the user id based on month day year? I see the 12 and instantly think date codes.
If you want random strings you could generate the id then query the database to see if that key is unique. But that would lead to horible indexing.

Ancient dragon is right you can generate an auto key with sql which is what I normally do.

Perhaps make a two column key one for your alpha prefix then one for your numeric. Start your numeric at 12002 and auto increment from there.

    select  'FHMS'  + max(SUBSTRING ( employeeId ,5 , 5 ))+1 as nextkey from employeemaster

    I hope This is the query you are looking for

yehey.! thnx a lot for the help guys :]

good sir, can you help me coz i created a system for my project which is HR Management Online using asp.net and C#. my question is how to create a good payroll system in an employee in the company. thnx a lot for the idea's and suggestions!

Have you written a design document yet? If not, then that's where you need to start.

close this thread and mark it solved, then open new thread with title payroll, so other payroll masters helps you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.