Generate Alpha-Numeric Values in SQL SERVER

Please support our MS SQL advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jun 2009
Posts: 67
Reputation: S2009 is an unknown quantity at this point 
Solved Threads: 0
S2009 S2009 is offline Offline
Junior Poster in Training

Generate Alpha-Numeric Values in SQL SERVER

 
0
  #1
Jul 4th, 2009
Hi all,

I am creating a windows application. I have a column in the backend - MS sql server 2005 as ID which stores Patient Id.

The values for this column should start with
PT and contain the serial numbers in ascending order.

Eg.
PT001
PT002
PT003

I want to generate this automatically however identity does not allow this type of values.

Then how can I do this?

Is there any way I could do this automatically?

Please help me out!
Thanks in advance!!
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 2,612
Reputation: adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of 
Solved Threads: 463
Moderator
adatapost's Avatar
adatapost adatapost is offline Offline
Posting Maven

Re: Generate Alpha-Numeric Values in SQL SERVER

 
0
  #2
Jul 5th, 2009
Use substring to seperate alphabets and digits and convert digits into to numeric for increments, append zeors and concat them.
Failure is not fatal, but failure to change might be. - John Wooden
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the MS SQL Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC