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 2008 Forums
 Transact-SQL (2008)
 Splitting Hour

Author  Topic 

RammohanB
Starting Member

9 Posts

Posted - 2012-12-11 : 11:15:06
select name, date, hour from pathlist
where date = '2012-12-09'

In the above query i need to split hour column data from hour 1 to hour 24 which is 24 columns..


Thanks,
Rammohan

Rammohan

RammohanB
Starting Member

9 Posts

Posted - 2012-12-11 : 11:15:36
I need to seperate hours using ,

Rammohan
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-12-11 : 11:25:06
Can you post a sample of your data in the pathlist table and the corresponding output you want to see?
Go to Top of Page

RammohanB
Starting Member

9 Posts

Posted - 2012-12-11 : 11:37:21
name hour date
IMO 9.10.11.12.13.14.15.16.17.18.19.20.21.22 2012-12-09


i want to split hour using . in hour column, so i have 14 hours and i need to show data as 14 columns using hour and name,date are same

Rammohan
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2012-12-11 : 23:58:15
Follow this link to split single column into multiple columns

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

--
Chandu
Go to Top of Page
   

- Advertisement -