CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS DATABASE SQL SERVER DETAILS
Question :
What is the pivot operator in MS SQL Server2005? What is the use of it and how do we use it
Category SQL Server Interview Questions
Rating (0.0) By 0 users
Added on 4/3/2008
Views 387
Rate it!
Answers:

The PIVOT operator rotates rows into columns, optionally performing aggregations or other mathematical calculations along the way. It widens the input table expression based on a given pivot column and generates an output table with a column for each unique value in the pivot column. The UNPIVOT operator performs an operation opposite to the one PIVOT performs; it rotates columns into rows. The UNPIVOT operator narrows the input table expression based on a pivot column.

For eg:

SELECT
CAST(YEAR(SaleDate) AS VARCHAR(4)), BigScreen, PoolTable, Computer
FROM
SalesHistory
PIVOT



(
SUM(SalePrice) FOR Product IN(BigScreen, PoolTable, Computer)



) AS p





If you have the better answer, then send it to us. We will display your answer after the approval.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification  Enter the above shown code:*
Inform me about updated answers to this question

   
Related Questions
View Answer
What are "HINTS"? What is "index covering" of a query?
View Answer
What are data objects?
View Answer
What is the difference between User Identification and Authentication?
View Answer
How to display the table data in XML format using SQL Server.
View Answer
What is XMLA in SQL Server 2005
View Answer
How many types of system privileges are there, Can we add or delete privileges?
View Answer
Write a SQL Stored Procedure to create a GUID and add it to a table. Make that GUID an OUTPUT of that Procedure
View Answer
Can we generate a trigger for two tables? if so what is the query to generate a trigger for two tables employee table and department table with employee having department no.
View Answer
I was asked in an interview...
"Suppose u have a field with UNIQUE KEY. can u leave two or more cells NULL in SQL Server 2005...If Yes then Why...if NOT then Why.....
View Answer
What is a "trigger"?
View Answer

Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

Notify me when better answer is posted!
Email:

View ALL SQL Server Interview Questions

User Options
Sponsored Links


Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions
Page URL: http://www.coolinterview.com/interview/14955/default.asp?cachecommand=bypass


Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

0.75