Click here to Skip to main content
16,012,821 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi to all programmer.
i need ur help for writing sql query ..
I m building a employee database in Which i want to Store Emp_Id coloumn with value like this"E000001" so pls help how i can write Sql query to to select select next Id in this Format..
thanks in advance..
Posted

Hello Ansh,

there is two approach to making this either you can have a seperate table in which you can define these case like for Employee "E000001" for purchase "PO00001"

Or you can have direct way like select max value from table employee substring the result and add 1 to numeric part and then combine again and ofcource check if its first value the hard code it with "E000001".

hoping this will help you

thanks
sanjeev
 
Share this answer
 
Comments
advancedansh 4-Aug-11 1:12am    
ya under stand but i dont know how to take out the numeric part from sting
hello for substring please read this article

Click Here[^]
 
Share this answer
 

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