SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Increment Alpha Numeric
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

NITINMITTAL01
Starting Member

2 Posts

Posted - 03/25/2013 :  21:26:11  Show Profile  Reply with Quote
Hello,
Need help with in writing a Stored Procedure for Auto Alpha Numeric Generation. If I pass an Alpha numeric in the format mentioned below , I should get next number based on the following logic:

Format : It consists of 6 digit Alpha Numeric Code , where E is constant. For ex : E00001

SP should generate like this:

E00001 to E99999 when it reaches to E99999 then 9 on left will be replaced with "A"- EA0001

EA0001 - EA9999
EB0001 - EB9999
EZ0001 - EZ9999 when it reaches EZ9999 it should be incrmented to E0A001

Thanks,
Nick

UnemployedInOz
Yak Posting Veteran

Australia
54 Posts

Posted - 03/26/2013 :  00:14:41  Show Profile  Reply with Quote
Have you considered creating a lookup table with all the possible combinations?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52309 Posts

Posted - 03/26/2013 :  14:32:06  Show Profile  Reply with Quote
see

http://www.sqlteam.com/article/custom-auto-generated-sequences-with-sql-server

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000