Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The parallel data warehouse (PDW) features are not enabled

Tags:

sql

sql-server

I have a WinForms client application that executes the following SQL statement with parameters.

SELECT a.CaseNo, (c.Claimant + ' -v- ' + c.Defendant) AS CaseName, 
       a.Allocation - ISNULL(LAG(a.Allocation) 
       OVER (PARTITION BY a.CaseNo, a.FeeEarner ORDER BY a.AllocID), 0) AS Billing, a.AllocID 
FROM tblAllocations AS a INNER JOIN tblCases AS c ON a.CaseNo = c.CaseNo
WHERE a.CaseNo > 0 AND FeeEarner = @FeeEarner 
AND a.Date >= @StartDate 
AND a.Date <= @EndDate ORDER BY a.Date;

When I run this on my laptop where I do my development work, the query executes with no issues. The information returned is used to populate a datagrid within the client application. I am using SQL Server 2012 Express.

However, when the exact same client application is run at my customer's premises the code returns an error. The majority of the error message is generated by my application which simply enables me to pinpoint where in the code the problem arises. However, at the end of the message where I append the system generated error, I get the following:

The parallel data warehouse (PDW) features are not enabled

I have never seen this message before and so am at a loss to determine what the problem is. I tried Google searches for this error message but have not found anything useful. My customer is using SQL Server 2008 R2 Express.

Is PDW a feature in SQL Express 2012 that isn't in the 2008 R2 version?

What is it about my query that requires PDW?

Is it the use of PARTITION, because that is a keyword I had not used previously until this query which is causing the issues?

Without getting the customer to change their SQL version is there any way to address this problem e.g. by changing my SQL query, or enabling something in SQL?

Any help would be most appreciated.

like image 243
PJW Avatar asked Oct 05 '22 03:10

PJW


1 Answers

The command LAG is only supported in SQL Server 2012.

Though I'm surprised by the error if this is the problem.

--Edit--

To replicate your query without using LAG:

This has basically been lifted from the article I mentioned;

SELECT 
       a.CaseNo, 
       (c.Claimant + ' -v- ' + c.Defendant) AS CaseName, 
       a.Allocation - ISNULL((
           CASE 
              WHEN N%2=1 
              THEN MAX(CASE 
                   WHEN N%2=0 
                   THEN a.Allocation 
                   END) 
              OVER (Partition BY N/2) 
              ELSE MAX(CASE 
                   WHEN N%2=1 
                   THEN a.Allocation
                   END) 
              OVER (Partition BY (N+1)/2) 
           END
       ), 0) AS Billing, 
       a.AllocID 
FROM tblAllocations AS a
LEFT JOIN (SELECT 
    Row_Number() OVER(ORDER BY b.Id) N,
    b.Id
  FROM tblAllocations as b) AS RowNum 
ON RowNum.id=a.id 
INNER JOIN tblCases AS c 
ON a.CaseNo = c.CaseNo
WHERE a.CaseNo > 0 
AND FeeEarner = @FeeEarner 
AND a.Date >= @StartDate 
AND a.Date <= @EndDate 
ORDER BY a.Date;

This is demo'd in the following:

SQL FIDDLE

like image 168
DMK Avatar answered Oct 10 '22 02:10

DMK