Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
sslow
Starting Member
6 Posts |
Posted - 2014-10-02 : 20:20:22
|
Hi All,I would like to take this 909A changing to 00909.May i know how was the code to remove the "A" and round to "00909".Must appreciate if you can provide me some example of code.Thanks for your patience. |
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2014-10-03 : 11:28:33
|
Need more information. Is the format always the same (e.g. NumberNumberNumberLetter)? Is it always four characters? Is the letter always at the end? Is it always an "A"? Elaborate, if you please... No amount of belief makes something a fact. -James Randi |
|
|
sslow
Starting Member
6 Posts |
Posted - 2014-10-07 : 04:57:13
|
Yes, the format is shown as yourNo, not alwys four characters in the question sometimes moreSometimes the letter will be change to other alphabet. |
|
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2014-10-07 : 15:25:54
|
declare @MyValue varchar(100) = '909A12345';select right('0000' + substring(@MyValue, 1, patindex('%[A-Z]%', @MyValue) - 1), 5) No amount of belief makes something a fact. -James Randi |
|
|
|
|
|