takes a table like:
date 0 1 2 3 4 5
3/15 a b c d e f
and converts it to
3/15 12:00am a
3/15 1:00am b
3/15 2:00am c
and so on
SELECT dateadd(hour,cast(times AS int),date), cast(times AS int), value
FROM (SELECT date, [0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10],
[11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23]
FROM b) AS p
UNPIVOT (value FOR times IN ([0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10],
[11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23]
)) AS s
No comments:
Post a Comment