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 a cell content into different column

Author  Topic 

monday2007
Starting Member

2 Posts

Posted - 2007-10-24 : 22:50:26
I need some help on the qs below
how to create sql statements to update the table to output???

thx!!

tbl_fruit<<<<<input

fruit 1 2 3
--------------------------------------
apple pear orange null null null
---------------------------------------
banana peach cherry null null null

tbl_fruit<<<<output

fruit 1 2 3
--------------------------------------
apple pear orange apple pear orange
---------------------------------------
banana peach cherry banana peach cherry

shallu1_gupta
Constraint Violating Yak Guru

394 Posts

Posted - 2007-10-25 : 00:28:42
It would be better for us if you explain ur problem clearly. i.e. structure of ur table along with what should be the output required.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-10-25 : 02:01:57
Look for charindex and substring functions in sql server help file


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

monday2007
Starting Member

2 Posts

Posted - 2007-10-25 : 09:43:15
tbl_fruit<<<<<input

fruit 1 2 3
--------------------------------------
apple pear orange null null null
---------------------------------------
banana peach cherry null null null


the 1st col is fruit
the 1st cell in the col is "apple pear orange"

how can i update the col '1', col'2' and col'3'
the result will be:
fruit | 1 | 2 | 3
-------------------------------------------
apple pear orange | applae | pear | orange


iam 1st time to meet this kind of qs, even no idea how to wirte the statement -_-''
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-10-25 : 09:50:00

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=50648

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -