Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 grouping sets
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

121 Posts

Posted - 04/24/2014 :  14:33:02  Show Profile  Reply with Quote
Hi All,
I just installed sql server 2008 on my computer. In order to understand the grouping sets, I got this example from the internet

INSERT Sales VALUES(1, 2005, 12000)
INSERT Sales VALUES(1, 2006, 18000)
INSERT Sales VALUES(1, 2007, 25000)
INSERT Sales VALUES(2, 2005, 15000)
INSERT Sales VALUES(2, 2006, 6000)
INSERT Sales VALUES(3, 2006, 20000)
INSERT Sales VALUES(3, 2007, 24000)

when I do this

SELECT EmpId, Yr, SUM(Sales) AS Sales
FROM Sales
GROUP BY GROUPING SETS((EmpId, Yr), (EmpId), (Yr), ())

I keep getting the error saying:

Msg 102, Level 15, State 1, Line 3
Incorrect syntax near 'SETS'.

I am not sure what am I doing wrong, but it seems that the new features that sql server 2008 that I installed does not recognize the new features that come with sql server 2008

when I go to help-> about
I see sql server 2008 so I was wondering if I need to do anything to enable these new 2008 features.

Flowing Fount of Yak Knowledge

4614 Posts

Posted - 04/24/2014 :  15:19:57  Show Profile  Reply with Quote
You can check the database to see what version of SQL it s running. 1. The Engine version and 2. the compatibility level:

SELECT compatibility_level
FROM sys.databases WHERE name = '<DatabaseName>';
Go to Top of Page

Posting Yak Master

121 Posts

Posted - 04/24/2014 :  17:57:41  Show Profile  Reply with Quote
The database version that I am running is 2005, If I am right clicking on a table and doing
Script Table as -> Create to-> new Query window
then I am getting an error saying "an exception occurred while executing a T-sql statement on batch". the Select permission was denied on the object database_recovery_statis database mssqlsystemresource, schema sys(Microsft sql server, error, 229)

I think this is happening because the database is in 2005 and I am using 2008 sql server management studio. Is there any workaround for this? so that if I right click on the table and say
Script Table as -> Create to-> new Query window
I don't get that error.

I wasn't getting this error when I was using sql server 2005 express edition.

any help will be highly appreciated.

Edited by - anjali5 on 04/24/2014 17:58:50
Go to Top of Page

Aged Yak Warrior

982 Posts

Posted - 04/24/2014 :  22:05:46  Show Profile  Reply with Quote
hi, i thinking that you might not have permission to query the table.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000