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
 General SQL Server Forums
 New to SQL Server Programming
 Query Problem

Author  Topic 

immad
Posting Yak Master

230 Posts

Posted - 2013-05-27 : 02:20:33
what is this key word mean UNPIVOT

SELECT
CID,
BID,
EID,
SName,
Year,
Month,
substring( Col, 2, 2 )Day
from
ROOASTER
UNPIVOT (SName FOR Col IN ([d1], [d2], [d3], [d4], [d5], [d6] , [d7] , [d8], [d9], [d10],[d11], [d12], [d13], [d14], [d15], [d16], [d17], [d18], [d19], [d20],[d21], [d22], [d23], [d24], [d25], [d26], [d27], [d28], [d29], [d30],[d31]))D
)T
INNER JOIN Employee T1 ON T.EID = T1.EID AND T.BID = T1.BID

immad uddin ahmed

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-05-27 : 02:40:53
UNPIVOT is the mechanism to convert Columns to Rows

Check the simple example
http://learnsqlserver.in/5/Unpivot.aspx

--
Chandu
Go to Top of Page

immad
Posting Yak Master

230 Posts

Posted - 2013-05-27 : 03:07:43
quote:
Originally posted by bandi

UNPIVOT is the mechanism to convert Columns to Rows

Check the simple example
http://learnsqlserver.in/5/Unpivot.aspx

--
Chandu


Thanks

immad uddin ahmed
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-05-27 : 03:16:58
quote:
Originally posted by immad

quote:
Originally posted by bandi

UNPIVOT is the mechanism to convert Columns to Rows
Check the simple example
http://learnsqlserver.in/5/Unpivot.aspx
--Chandu


Welcome

--
Chandu
Go to Top of Page
   

- Advertisement -