Solved

Group by x,x,x with rollup works, group by rollup (x,x,x) doesn't 2005

Posted on 2011-03-03
3
1,056 Views
Last Modified: 2012-05-11
I'm trying to use the rollup function. The sql server 2005 manual states that 'with rollup' is not ISO standard, and will be removed, don't do any development work with this format, by which I presume they mean use the 'group by rollup' function. They give the example code below in the documentation

SELECT a, b, c, SUM ( <expression> )
FROM T
GROUP BY ROLLUP (a,b,c);

Open in new window


I have tried this and it returns

Msg 195, Level 15, State 10, Line 3
'ROLLUP' is not a recognized built-in function name.

The database is set to level 90 (SQL 2005)

I am probably going to go with using 'with rollup' for now, but just want to check that the SQL documentation is actually wrong for this function. Or do I need to check for patches to the SQL server engine?
 
0
Comment
Question by:PCIIain
  • 2
3 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 35026779
what is the database compatibility version of your database?
if it's set to 80 (sql 2000), it will indeed pretend not to know that function ...
0
 
LVL 13

Author Comment

by:PCIIain
ID: 35026980
Nope, SQL Server 2005 (90)

it works with 'group by x,x,x with rollup' which is set to be removed from SQL server (I don't think 2000 will work with 'with rollup' either will it?), it's the group by rollup (x,x,x); that fails.

0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 35106192
actually, I have gone through the documentations, and found that the ROLLUP operator is only as from sql 2008:

sql 2005 doc:
http://msdn.microsoft.com/en-us/library/ms177673%28v=SQL.90%29.aspx
you have the GROUP BY xxx WITH ROLLUP  (or WITH CUBE)

sql 2008 doc:
http://msdn.microsoft.com/en-us/library/ms177673%28v=SQL.100%29.aspx
you have the ROLLUP operator

not sure where I read previously that the rollup operator would be available in SQL 2005 also...
in the Analytics Server eventually...

so, in short: the answer is: not available in sql 2005
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Suggested Solutions

There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now