Meagan K Warncke
Meagan K Warncke

Reputation: 13

Incorrect syntax near 'SETS'. - SQL Server 2005

My code:

Group BY 
  GROUPING SETS 
  ( 
        (wmsSponsorEntityName), 
        (wmsSponsorEntityPrimaryRegion), 
        (wmsProjectNameSWP) , 
        ()          
  )

I'm doing this because those three fields repeat and the other two:

w.[P2010]

w.wugCounty

differ for some wmsProjectNameSWP

wmsSponsorEntityName | wmsSponsorEntityPrimaryRegion | wmsProjectNameSWP | w.wugCounty | P2010

ABERNATHY | O | Local groundwater development | LUBBOCK | 808

ABERNATHY | O | Local groundwater development | HALE | 2297

But I receive an error of Incorrect syntax near 'SETS'.

Any guidance would be appreciated.

Upvotes: 0

Views: 461

Answers (1)

Greg
Greg

Reputation: 4035

GROUPING SETS was introduced in SQL Server 2008. Which means if you are on SQL Server 2005, you will get a syntax error since it doesn't exist.

Upvotes: 2

Related Questions