0

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!

6
Contributors
10
Replies
27
Views
4 Years
Discussion Span
Last Post by sandeepmittal11
Featured Replies
0

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

2

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

Edited by Ancient Dragon

0

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.. :]

1

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.

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

    I hope This is the query you are looking for
0

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!

0

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

This topic has been dead for over six months. 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.