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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Split

Author  Topic 

WoodHouse
Posting Yak Master

211 Posts

Posted - 2009-11-14 : 04:05:32
Hi

I have data in single column.


10 �0005218932500089959 HUYNH VAN L 04 T C27 5 10,005.05 13/11/97 02/03/09 06 05 04 03 02 01 00
11 �0005218932500494126 FERRES LINDA 04 D IDC 6 8,191.82 04/03/04 27/08/09 02 00 00 00 00 00 00
12 �0005218932501067608 RISTESKI BRANKO 04 T C27 5 7,876.75 04/01/06 03/03/09 06 05 04 03 02 01 00
13 �0005218932501247929 JOHNSON DAVID F 04 B IDC 6 7,974.11 04/03/03 14/07/09 04 01 00 00 00 00 00
14 �0005218932501303607 RICHES KRISTIAN 04 L I CGA 5 4,550.19 04/06/05 03/03/09 15 12 10 07 02 01 00
15 �0005218932501313101 HYDE LON NOE J 04 B IDC 6 2,122.33 04/05/00 27/07/09 03 00 00 00 00 00 00
16 �0005218932501584917 YOO ADRIAN 04 I L M60 5 6,701.62 04/03/06 12/03/09 09 05 04 03 02 01 00
17 �0005218932502055651 FISHER NIKKI 04 T L C27 5 6,829.02 04/01/05 17/02/09 10 06 04 03 02 01 00


the above data in single column..

so i need to split the data from single column to store in seperate column(delimitor is space)

please help on this...

thanks

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-11-14 : 08:45:39
Use substring().
Example as approach:
select
substring(YourSingleColumn,1,8) as ID,
substring(YourSingleColumn,9,19) as OtherColumn,
...
from ...


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2009-11-14 : 14:20:36
That looks like fixed-width data to me, not space delimited.

________________________________________________
If it is not practically useful, then it is practically useless.
________________________________________________
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-11-14 : 17:56:06
Yes - that's why I said use substring().


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2009-11-15 : 01:25:40
I understood that. Just looking for clarification from the OP....

________________________________________________
If it is not practically useful, then it is practically useless.
________________________________________________
Go to Top of Page
   

- Advertisement -