dbTalk Databases Forums  

SQL Server 2005 Pivot Bug

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss SQL Server 2005 Pivot Bug in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
rmgalante@yahoo.com
 
Posts: n/a

Default SQL Server 2005 Pivot Bug - 12-11-2005 , 12:39 PM






I am trying to implement a simple pivot table with the following sql
statement, but the query analyzer reports a syntax error.

SELECT CategoryName AS Category, ProductName AS Product, [1] AS
Y1997Q1, [2] AS Y1997Q2, [3] AS Y1997Q3, [4] AS Y1997Q4
FROM dbo.OrdersByProduct1997
PIVOT (SUM(ProductOrders) FOR Quarter IN([1], [2], [3], [4])) AS
QuarterlyOrders
ORDER BY CategoryName, ProductName

Incorrect syntax near '('

Is the command parser broken?


Reply With Quote
  #2  
Old   
Darren Gosbell
 
Posts: n/a

Default Re: SQL Server 2005 Pivot Bug - 12-12-2005 , 06:29 AM






I don't think so. I did the following similar pivot against
AdventureWorksDW and it worked OK.

Quote:
USE AdventureWorksDW;
GO

SELECT AccountKey, DepartmentGroupKey,[1] as Scen1, [2] as Scen2
FROM FactFinance
PIVOT (Sum(Amount) for ScenarioKey IN([1],[2])) as x
ORDER BY AccountKey, DepartmentGroupKey;
Quote:
--
Regards
Darren Gosbell [MCSD]
Blog: http://www.geekswithblogs.net/darrengosbell

In article <1134326351.348930.297780 (AT) g44g2000cwa (DOT) googlegroups.com>,
rmgalante (AT) yahoo (DOT) com says...
Quote:
I am trying to implement a simple pivot table with the following sql
statement, but the query analyzer reports a syntax error.

SELECT CategoryName AS Category, ProductName AS Product, [1] AS
Y1997Q1, [2] AS Y1997Q2, [3] AS Y1997Q3, [4] AS Y1997Q4
FROM dbo.OrdersByProduct1997
PIVOT (SUM(ProductOrders) FOR Quarter IN([1], [2], [3], [4])) AS
QuarterlyOrders
ORDER BY CategoryName, ProductName

Incorrect syntax near '('

Is the command parser broken?



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.