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,060 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

948 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

17 Experts available now in Live!

Get 1:1 Help Now