Incorrect Syntax near key word PIVOT

Posted on 2010-03-31
Medium Priority
Last Modified: 2012-05-09
when i use the query below.. iam getting the error.. Pls help

select [File Name], [Contract Number], [1005], [1006], [1007], [1008] from
(select a.[File Name], a.[Contract Number], a.[Exception Code], b.[Exception Description]
 from dbo.contractExceptions a join dbo.ExceptionDescriptions b
  on a.[Exception Code] = b.[Exception Code] where [Contract Number] = '014IF0593')
PIVOT (select [Exception Code] from dbo.contractExceptions where
 [Contract Number] = '014IF0593' and [Exception Code] in (select [Exception Code]
 from dbo.ExceptionDescriptions) )
Question by:gautam_reddyc
  • 2
LVL 75

Accepted Solution

Aneesh Retnakaran earned 2000 total points
ID: 29220486

Author Comment

ID: 29222823
where do you think i went wrong.. can you pls correct it.. it's confusing

Author Comment

ID: 29224723
here in my query.. we need to use pivot with out aggregate function

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Earlier I wrote an article about the new lookup functions (http://www.experts-exchange.com/A_3433.html) that ship with SQL Server 2008 R2.  In this article I’m going to show you another new feature of SSRS 2008 R2, this time in the vis…
In this article, we will see two different methods to recover deleted data. The first option will be using the transaction log to identify the operation and restore it in a specified section of the transaction log. The second option is simpler and c…
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.
Suggested Courses

594 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question