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 |
|
wira_chen
Starting Member
4 Posts |
Posted - 2005-12-21 : 03:16:23
|
| Hi Bro,Could you help me about split string? I want to split a string and insert it to a new tabel example : i have a field (description)and description containts : Description12/8/2005 9:00:48 2005_12_8_8_52_3_173633 L_U3_GOV_TURBINETRIP To 012/8/2005 9:15:35 2005_12_8_9_11_11_985836 L_U3_TX_WINDINGOVER To 112/8/2005 9:11:14 2005_12_8_8_52_3_173633 L_U3_CB_BREAKERCLOSEDTo 1i want to split string in description field make to :Date Time Value Description2005_12_8 8_52_3 173633 L_U3_GOV_TURBINE TRIP To 02005_12_8 9_11_11 985836 L_U3_TX_WINDING OVER To 12005_12_8 8_52_3 173633 L_U3_CB_BREAKER CLOSEDTo 1so i want split the string by 'backspace'i'm use sql server to a database connection Can you help me about this bro?? thank's for your interesting.RegardsWira Chan |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
Frank Kalis
Constraint Violating Yak Guru
413 Posts |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2005-12-21 : 04:13:29
|
Hi Bro,Backspace dellimmiter?as in Ascii cahracter 8?Try this.SELECT LEFT(COL1, CHARINDEX(CHAR(8), COL1) - 1) [DATE_TIME], SUBSTRING(COL1, CHARINDEX(CHAR(8), COL1) + 1, CHARINDEX(CHAR(8), COL1, CHARINDEX(CHAR(8), COL1) + 1) - CHARINDEX(CHAR(8), COL1) -1) [Value], RIGHT(COL1, CHARINDEX(CHAR(8), REVERSE(COL1)) - 1)FROM MyTableCheers Bro.Duane. "It's a thankless job, but I've got a lot of Karma to burn off." |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2005-12-21 : 04:26:47
|
| >>Backspace dellimmiter?>>as in Ascii cahracter 8?i think it should be 'blank space'-----------------[KH]Learn something new everyday |
 |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2005-12-21 : 04:30:25
|
>> i think it should be 'blank space'I doubt that - the description field contains blank spaces, but if blank spaces are being used as a dellimitter - i think it would be quite silly.Duane. "It's a thankless job, but I've got a lot of Karma to burn off." |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2005-12-21 : 06:14:18
|
| >> I doubt that - the description field contains blank spaces, but if blank spaces are being used as a dellimitter - i think it would be quite silly.hmmmm..... maybe you are right-----------------[KH]Learn something new everyday |
 |
|
|
wira_chen
Starting Member
4 Posts |
Posted - 2005-12-21 : 21:56:21
|
| Thank's For your all Information, Bro!RegardsWira Chen |
 |
|
|
|
|
|
|
|