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 |
|
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2010-06-04 : 11:04:58
|
| [code]I have the below data.A00920100331AUDU09JK20100330USDand would require the below output..A009|20100331U09JK|20100330Note:I want to exclude the last 3 currency characters and also to include "|" before the datetime (ie 20100330 or 20100331).Thanks for your help in advance.[/code] |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-06-04 : 11:18:23
|
| Here is one wayselect data,substring(data,1,charindex(right(left(data,len(data)-3),8),data)-1)+'|'+ right(left(data,len(data)-3),8) from(select 'A00920100331AUD' as data union allselect 'U09JK20100330USD') as tMadhivananFailing to plan is Planning to fail |
 |
|
|
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2010-06-04 : 11:22:13
|
| Thanks Madhivanan |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-06-04 : 11:27:48
|
quote: Originally posted by sqlfresher2k7 Thanks Madhivanan
You are welcomeMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|