SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query Problem
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

immad
Posting Yak Master

Pakistan
218 Posts

Posted - 05/27/2013 :  02:20:33  Show Profile  Reply with Quote
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

Edited by - immad on 05/27/2013 02:21:20

bandi
Flowing Fount of Yak Knowledge

India
2202 Posts

Posted - 05/27/2013 :  02:40:53  Show Profile  Reply with Quote
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

Pakistan
218 Posts

Posted - 05/27/2013 :  03:07:43  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
2202 Posts

Posted - 05/27/2013 :  03:16:58  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000