Click here to Skip to main content
15,890,946 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Any one guide how to create a sequential ID For VacancyId like V0001 and Applicant ID like A0001

thanks.
Posted
Comments
_Asif_ 19-Jan-16 2:42am    
What have you tried?
Member 11151453 19-Jan-16 2:52am    
create a recruitment process system
I need Vancay Id which is started from V0001 to V5000 sequentially.

Can you help me create this ID using C# or SQL
_Asif_ 19-Jan-16 2:53am    
you now have a Solution

I ususally advise to just use the built-in IDENTITY column on each table (you *do* have separate tables for Applicants and Vacancies don't you?)

The only time you need to format the id is at the point of presentation to the user.
It also helps with the situation where you end up with more than 9999 vacancies and have to reformat the number e.g. V09999 - you're not changing any data, just the way it is displayed
 
Share this answer
 
you can have a look at this and use it to your advantage:
http://raresql.com/2013/06/21/sql-server-2012-how-to-generate-a-varchar-sequence-number-using-sequence-object/
 
Share this answer
 
That's pretty simple: you need to permanently store the current value, e.g. using a file or a database (I would store only the integer part, of course) and increment it when needed.
 
Share this answer
 
Comments
Member 11151453 19-Jan-16 5:24am    
Kindly give some code for idea how ill do it.
Kats2512 19-Jan-16 9:44am    
sound like this is homework, nothing comes for free. did you even check on google???
CHill60 19-Jan-16 10:19am    
Would this be advisable in a multi-user environment? What's wrong with using the SQL IDENTITY column?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900