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 2000 Forums
 SQL Server Development (2000)
 Display comma delimited values in seperate columns

Author  Topic 

LDev
Starting Member

1 Post

Posted - 2008-06-30 : 05:53:45
I have a table and in one of the columns it stores values seperated by comma's. Is there anyway i can display those in individual columns on select statement in stored procedure.

e.g.
ID|Name|Laps|Times
1 |Test|3 |(01)12:12:12,(02)13:23:12,(03)14:12:23

To be display as:

ID|Name|Laps|Lap1 |Lap2 |Lap3
1 |Test|3 |12:12:12|13:23:12|14:12:23

Any Advice Appreciated
Thanks In Advance

sachinsamuel
Constraint Violating Yak Guru

383 Posts

Posted - 2008-06-30 : 06:18:01
You can create a table datatype and create columns on runtime based on the comma separated values.



Don't sit back because of failure. It will come back to check if you still available. -- Binu
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-07-01 : 16:49:58
You should normalise the table
Also read about Parsename function

Madhivanan

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

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-01 : 18:18:59
use the function here http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=76033


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -