Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

SQL Server 2008: How to convert table Columns as part of values in a resulting View?

$
0
0

Existing Database Table:

DateTimeLog

ColAA

ColBB

ColCC

ColDD

1/1/14

12

9

6

15

1/2/14

8

6

4

10

1/3/14

4

3

2

5

Can a View, as below, be created out of the Table above wherein all columnsexcept column DateTimeLog, i.e. ColAA, ColBB, etc on the Table become values in a View's column named MyCols, and its values go to a column named Value?

DateTimeLog

MyCols

Value

1/1/14

ColAA

12

1/2/14

ColAA

8

1/3/14

ColAA

4

1/1/14

ColBB

9

1/2/14

ColBB

6

1/3/14

ColBB

3

1/1/14

ColCC

6

1/2/14

ColCC

4

1/3/14

ColCC

2

1/1/14

ColDD

15

1/2/14

ColDD

10

1/3/14

ColDD

5


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>