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 |
|
cnbhold
Starting Member
43 Posts |
Posted - 2010-07-30 : 11:57:37
|
| I have SQL table that has software version information. I need a way to convert the following column of dataVersion11.010.09.098.0.0.27348.0.277.07.0.16.06.1.2Convert ToVersion11.x10.x9.x9.x8.x8.x7.x7.x7.x6.x6.xAngel |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-07-30 : 12:10:34
|
| [code]UPDATE YourTableSET version = left(version, Abs(charindex('.', version)-1)) + '.x'[/code] |
 |
|
|
cnbhold
Starting Member
43 Posts |
Posted - 2010-07-30 : 13:30:18
|
| This works great only if the version number is for example 7.0 or 7 is converted to 7.x but for 11 without a period is converted to 1 Not sure what to change to get the double digits without a period to convert correctly.Angel |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-07-30 : 13:54:13
|
quote: Originally posted by russell
UPDATE YourTableSET version = left(version, Abs(charindex('.', version+'.')-1)) + '.x'
No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
cnbhold
Starting Member
43 Posts |
Posted - 2010-07-30 : 14:02:53
|
| Thanks worked! Thanks Russell and Webfred for all your help.Angel |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-07-30 : 14:08:06
|
welcome  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|