How to use Rollup Grouping Function error in SQL DW?How can I prevent SQL injection in PHP?How do I perform an IF…THEN in an SQL SELECT?Add a column with a default value to an existing table in SQL ServerHow to return only the Date from a SQL Server DateTime datatypeHow to concatenate text from multiple rows into a single text string in SQL server?Inserting multiple rows in a single SQL query?How do I UPDATE from a SELECT in SQL Server?Finding duplicate values in a SQL tableSelect first row in each GROUP BY group?How to import an SQL file using the command line in MySQL?

When an imagined world resembles or has similarities with a famous world

How in the world do I place line of text EVENLY between two horizontal tikz lines?

GitLab account hacked and repo wiped

How do LIGO and VIRGO know that a gravitational wave has its origin in a neutron star or a black hole?

Is Benjen dead?

What to use instead of cling film to wrap pastry

What are the advantages of luxury car brands like Acura/Lexus over their sibling non-luxury brands Honda/Toyota?

Why did WWI include Japan?

History of the kernel of a homomorphism?

Install LibreOffice-Writer Only not LibreOffice whole package

Are there terms in German for different skull shapes?

Gerrymandering Puzzle - Rig the Election

Has a commercial or military jet bi-plane ever been manufactured?

Do publishers care if submitted work has already been copyrighted?

How long would it take for people to notice a mass disappearance?

Mug and wireframe entirely disappeared

Has the Hulk always been able to talk?

How should I tell my manager I'm not paying for an optional after work event I'm not going to?

Why didn't this character get a funeral at the end of Avengers: Endgame?

Is the book wrong about the Nyquist Sampling Criterion?

Is disk brake effectiveness mitigated by tyres losing traction under strong braking?

It is as simple as ABC

Is there a word that describes the unjustified use of a more complex word?

Can my 2 children, aged 10 and 12, who are US citizens, travel to the USA on expired American passports?



How to use Rollup Grouping Function error in SQL DW?


How can I prevent SQL injection in PHP?How do I perform an IF…THEN in an SQL SELECT?Add a column with a default value to an existing table in SQL ServerHow to return only the Date from a SQL Server DateTime datatypeHow to concatenate text from multiple rows into a single text string in SQL server?Inserting multiple rows in a single SQL query?How do I UPDATE from a SELECT in SQL Server?Finding duplicate values in a SQL tableSelect first row in each GROUP BY group?How to import an SQL file using the command line in MySQL?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I'm getting the error thatROLLUP is not a function name but the documentation says it should work
Msg 104162, Level 16, State 1, Line 2
'ROLLUP' is not a recognized built-in function name.



I've tried group by grouping sets but it told me the syntax was wrong, that's when I saw that grouping sets doesn't work with DW



SELECT S.[ProjectID]
,P.ProjectId
,P.Level2
,S.[PTDIncurredAmount]
,S.[PriorYearIncurredAmount]
,S.[YTDIncurredAmount], sum([YTDIncurredAmount]) as CTDActuals
FROM [Fact].[vProjectSummary] as S
JOIN dim.vProject as P on S.ProjectID=P.ProjectId
Group by ROLLUP (P.Level2, S.ProjectID )


If anyone can point me to more specifically the problem with this code for Azure SQL DW I'd greatly appreciate it!










share|improve this question




























    1















    I'm getting the error thatROLLUP is not a function name but the documentation says it should work
    Msg 104162, Level 16, State 1, Line 2
    'ROLLUP' is not a recognized built-in function name.



    I've tried group by grouping sets but it told me the syntax was wrong, that's when I saw that grouping sets doesn't work with DW



    SELECT S.[ProjectID]
    ,P.ProjectId
    ,P.Level2
    ,S.[PTDIncurredAmount]
    ,S.[PriorYearIncurredAmount]
    ,S.[YTDIncurredAmount], sum([YTDIncurredAmount]) as CTDActuals
    FROM [Fact].[vProjectSummary] as S
    JOIN dim.vProject as P on S.ProjectID=P.ProjectId
    Group by ROLLUP (P.Level2, S.ProjectID )


    If anyone can point me to more specifically the problem with this code for Azure SQL DW I'd greatly appreciate it!










    share|improve this question
























      1












      1








      1








      I'm getting the error thatROLLUP is not a function name but the documentation says it should work
      Msg 104162, Level 16, State 1, Line 2
      'ROLLUP' is not a recognized built-in function name.



      I've tried group by grouping sets but it told me the syntax was wrong, that's when I saw that grouping sets doesn't work with DW



      SELECT S.[ProjectID]
      ,P.ProjectId
      ,P.Level2
      ,S.[PTDIncurredAmount]
      ,S.[PriorYearIncurredAmount]
      ,S.[YTDIncurredAmount], sum([YTDIncurredAmount]) as CTDActuals
      FROM [Fact].[vProjectSummary] as S
      JOIN dim.vProject as P on S.ProjectID=P.ProjectId
      Group by ROLLUP (P.Level2, S.ProjectID )


      If anyone can point me to more specifically the problem with this code for Azure SQL DW I'd greatly appreciate it!










      share|improve this question














      I'm getting the error thatROLLUP is not a function name but the documentation says it should work
      Msg 104162, Level 16, State 1, Line 2
      'ROLLUP' is not a recognized built-in function name.



      I've tried group by grouping sets but it told me the syntax was wrong, that's when I saw that grouping sets doesn't work with DW



      SELECT S.[ProjectID]
      ,P.ProjectId
      ,P.Level2
      ,S.[PTDIncurredAmount]
      ,S.[PriorYearIncurredAmount]
      ,S.[YTDIncurredAmount], sum([YTDIncurredAmount]) as CTDActuals
      FROM [Fact].[vProjectSummary] as S
      JOIN dim.vProject as P on S.ProjectID=P.ProjectId
      Group by ROLLUP (P.Level2, S.ProjectID )


      If anyone can point me to more specifically the problem with this code for Azure SQL DW I'd greatly appreciate it!







      sql azure azure-sql-data-warehouse






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 23 at 1:28









      Madalo Furaha MeredithMadalo Furaha Meredith

      83




      83






















          1 Answer
          1






          active

          oldest

          votes


















          0














          According to this github documentation ROLLUP is not supported:




          The GROUP BY T-SQL clause aggregates data to a summary set of rows.
          GROUP BY has some options that SQL Data Warehouse does not support.
          These options have workarounds.



          These options are



          GROUP BY with ROLLUP



          GROUPING SETS



          GROUP BY with CUBE




          The workaround suggested is to use UNION ALL to simulate the ROLLUP. If I take a simplified version of your query



          SELECT S.projectID, p.Level2, SUM( [YTDIncurredAmount] )
          FROM [Fact].[vProjectSummary] AS S
          INNER JOIN dim.vProject AS P ON S.ProjectID = P.ProjectId
          GROUP BY ROLLUP ( P.Level2, S.ProjectID )
          ORDER BY 1, 2, 3


          By using ROLLUP this query requests the following aggregations:



          • Level2 and ProjectId

          • Level2

          • Grand total

          You can simulate this with UNION ALL:



          -- Level 2 and ProjectID
          SELECT S.ProjectID, p.Level2, SUM( [YTDIncurredAmount] )
          FROM [Fact].[vProjectSummary] AS S
          INNER JOIN dim.vProject AS P ON S.ProjectID = P.ProjectID
          GROUP BY S.ProjectID, p.Level2

          UNION ALL

          -- Level 2
          SELECT NULL, p.Level2, SUM( [YTDIncurredAmount] )
          FROM [Fact].[vProjectSummary] AS S
          INNER JOIN dim.vProject AS P ON S.ProjectID = P.ProjectID
          GROUP BY p.Level2

          UNION ALL

          -- Grand total
          SELECT NULL, NULL, SUM( [YTDIncurredAmount] )
          FROM [Fact].[vProjectSummary] AS S
          INNER JOIN dim.vProject AS P ON S.ProjectID = P.ProjectID


          I could not get any queries using ROLLUP to work although this link does seem to suggest it's possible:



          https://docs.microsoft.com/en-us/sql/t-sql/queries/select-group-by-transact-sql?view=sql-server-2017



          There is also a feedback item you can vote for here:



          https://feedback.azure.com/forums/307516-sql-data-warehouse/suggestions/35836048-grouping-and-group-by-rollup-functions-needs-to-be






          share|improve this answer























          • Paging @RonDunn - is there an issue with the docs? Does seem to imply ROLLUP is possible.

            – wBob
            Mar 23 at 12:30











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55309756%2fhow-to-use-rollup-grouping-function-error-in-sql-dw%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          According to this github documentation ROLLUP is not supported:




          The GROUP BY T-SQL clause aggregates data to a summary set of rows.
          GROUP BY has some options that SQL Data Warehouse does not support.
          These options have workarounds.



          These options are



          GROUP BY with ROLLUP



          GROUPING SETS



          GROUP BY with CUBE




          The workaround suggested is to use UNION ALL to simulate the ROLLUP. If I take a simplified version of your query



          SELECT S.projectID, p.Level2, SUM( [YTDIncurredAmount] )
          FROM [Fact].[vProjectSummary] AS S
          INNER JOIN dim.vProject AS P ON S.ProjectID = P.ProjectId
          GROUP BY ROLLUP ( P.Level2, S.ProjectID )
          ORDER BY 1, 2, 3


          By using ROLLUP this query requests the following aggregations:



          • Level2 and ProjectId

          • Level2

          • Grand total

          You can simulate this with UNION ALL:



          -- Level 2 and ProjectID
          SELECT S.ProjectID, p.Level2, SUM( [YTDIncurredAmount] )
          FROM [Fact].[vProjectSummary] AS S
          INNER JOIN dim.vProject AS P ON S.ProjectID = P.ProjectID
          GROUP BY S.ProjectID, p.Level2

          UNION ALL

          -- Level 2
          SELECT NULL, p.Level2, SUM( [YTDIncurredAmount] )
          FROM [Fact].[vProjectSummary] AS S
          INNER JOIN dim.vProject AS P ON S.ProjectID = P.ProjectID
          GROUP BY p.Level2

          UNION ALL

          -- Grand total
          SELECT NULL, NULL, SUM( [YTDIncurredAmount] )
          FROM [Fact].[vProjectSummary] AS S
          INNER JOIN dim.vProject AS P ON S.ProjectID = P.ProjectID


          I could not get any queries using ROLLUP to work although this link does seem to suggest it's possible:



          https://docs.microsoft.com/en-us/sql/t-sql/queries/select-group-by-transact-sql?view=sql-server-2017



          There is also a feedback item you can vote for here:



          https://feedback.azure.com/forums/307516-sql-data-warehouse/suggestions/35836048-grouping-and-group-by-rollup-functions-needs-to-be






          share|improve this answer























          • Paging @RonDunn - is there an issue with the docs? Does seem to imply ROLLUP is possible.

            – wBob
            Mar 23 at 12:30















          0














          According to this github documentation ROLLUP is not supported:




          The GROUP BY T-SQL clause aggregates data to a summary set of rows.
          GROUP BY has some options that SQL Data Warehouse does not support.
          These options have workarounds.



          These options are



          GROUP BY with ROLLUP



          GROUPING SETS



          GROUP BY with CUBE




          The workaround suggested is to use UNION ALL to simulate the ROLLUP. If I take a simplified version of your query



          SELECT S.projectID, p.Level2, SUM( [YTDIncurredAmount] )
          FROM [Fact].[vProjectSummary] AS S
          INNER JOIN dim.vProject AS P ON S.ProjectID = P.ProjectId
          GROUP BY ROLLUP ( P.Level2, S.ProjectID )
          ORDER BY 1, 2, 3


          By using ROLLUP this query requests the following aggregations:



          • Level2 and ProjectId

          • Level2

          • Grand total

          You can simulate this with UNION ALL:



          -- Level 2 and ProjectID
          SELECT S.ProjectID, p.Level2, SUM( [YTDIncurredAmount] )
          FROM [Fact].[vProjectSummary] AS S
          INNER JOIN dim.vProject AS P ON S.ProjectID = P.ProjectID
          GROUP BY S.ProjectID, p.Level2

          UNION ALL

          -- Level 2
          SELECT NULL, p.Level2, SUM( [YTDIncurredAmount] )
          FROM [Fact].[vProjectSummary] AS S
          INNER JOIN dim.vProject AS P ON S.ProjectID = P.ProjectID
          GROUP BY p.Level2

          UNION ALL

          -- Grand total
          SELECT NULL, NULL, SUM( [YTDIncurredAmount] )
          FROM [Fact].[vProjectSummary] AS S
          INNER JOIN dim.vProject AS P ON S.ProjectID = P.ProjectID


          I could not get any queries using ROLLUP to work although this link does seem to suggest it's possible:



          https://docs.microsoft.com/en-us/sql/t-sql/queries/select-group-by-transact-sql?view=sql-server-2017



          There is also a feedback item you can vote for here:



          https://feedback.azure.com/forums/307516-sql-data-warehouse/suggestions/35836048-grouping-and-group-by-rollup-functions-needs-to-be






          share|improve this answer























          • Paging @RonDunn - is there an issue with the docs? Does seem to imply ROLLUP is possible.

            – wBob
            Mar 23 at 12:30













          0












          0








          0







          According to this github documentation ROLLUP is not supported:




          The GROUP BY T-SQL clause aggregates data to a summary set of rows.
          GROUP BY has some options that SQL Data Warehouse does not support.
          These options have workarounds.



          These options are



          GROUP BY with ROLLUP



          GROUPING SETS



          GROUP BY with CUBE




          The workaround suggested is to use UNION ALL to simulate the ROLLUP. If I take a simplified version of your query



          SELECT S.projectID, p.Level2, SUM( [YTDIncurredAmount] )
          FROM [Fact].[vProjectSummary] AS S
          INNER JOIN dim.vProject AS P ON S.ProjectID = P.ProjectId
          GROUP BY ROLLUP ( P.Level2, S.ProjectID )
          ORDER BY 1, 2, 3


          By using ROLLUP this query requests the following aggregations:



          • Level2 and ProjectId

          • Level2

          • Grand total

          You can simulate this with UNION ALL:



          -- Level 2 and ProjectID
          SELECT S.ProjectID, p.Level2, SUM( [YTDIncurredAmount] )
          FROM [Fact].[vProjectSummary] AS S
          INNER JOIN dim.vProject AS P ON S.ProjectID = P.ProjectID
          GROUP BY S.ProjectID, p.Level2

          UNION ALL

          -- Level 2
          SELECT NULL, p.Level2, SUM( [YTDIncurredAmount] )
          FROM [Fact].[vProjectSummary] AS S
          INNER JOIN dim.vProject AS P ON S.ProjectID = P.ProjectID
          GROUP BY p.Level2

          UNION ALL

          -- Grand total
          SELECT NULL, NULL, SUM( [YTDIncurredAmount] )
          FROM [Fact].[vProjectSummary] AS S
          INNER JOIN dim.vProject AS P ON S.ProjectID = P.ProjectID


          I could not get any queries using ROLLUP to work although this link does seem to suggest it's possible:



          https://docs.microsoft.com/en-us/sql/t-sql/queries/select-group-by-transact-sql?view=sql-server-2017



          There is also a feedback item you can vote for here:



          https://feedback.azure.com/forums/307516-sql-data-warehouse/suggestions/35836048-grouping-and-group-by-rollup-functions-needs-to-be






          share|improve this answer













          According to this github documentation ROLLUP is not supported:




          The GROUP BY T-SQL clause aggregates data to a summary set of rows.
          GROUP BY has some options that SQL Data Warehouse does not support.
          These options have workarounds.



          These options are



          GROUP BY with ROLLUP



          GROUPING SETS



          GROUP BY with CUBE




          The workaround suggested is to use UNION ALL to simulate the ROLLUP. If I take a simplified version of your query



          SELECT S.projectID, p.Level2, SUM( [YTDIncurredAmount] )
          FROM [Fact].[vProjectSummary] AS S
          INNER JOIN dim.vProject AS P ON S.ProjectID = P.ProjectId
          GROUP BY ROLLUP ( P.Level2, S.ProjectID )
          ORDER BY 1, 2, 3


          By using ROLLUP this query requests the following aggregations:



          • Level2 and ProjectId

          • Level2

          • Grand total

          You can simulate this with UNION ALL:



          -- Level 2 and ProjectID
          SELECT S.ProjectID, p.Level2, SUM( [YTDIncurredAmount] )
          FROM [Fact].[vProjectSummary] AS S
          INNER JOIN dim.vProject AS P ON S.ProjectID = P.ProjectID
          GROUP BY S.ProjectID, p.Level2

          UNION ALL

          -- Level 2
          SELECT NULL, p.Level2, SUM( [YTDIncurredAmount] )
          FROM [Fact].[vProjectSummary] AS S
          INNER JOIN dim.vProject AS P ON S.ProjectID = P.ProjectID
          GROUP BY p.Level2

          UNION ALL

          -- Grand total
          SELECT NULL, NULL, SUM( [YTDIncurredAmount] )
          FROM [Fact].[vProjectSummary] AS S
          INNER JOIN dim.vProject AS P ON S.ProjectID = P.ProjectID


          I could not get any queries using ROLLUP to work although this link does seem to suggest it's possible:



          https://docs.microsoft.com/en-us/sql/t-sql/queries/select-group-by-transact-sql?view=sql-server-2017



          There is also a feedback item you can vote for here:



          https://feedback.azure.com/forums/307516-sql-data-warehouse/suggestions/35836048-grouping-and-group-by-rollup-functions-needs-to-be







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 23 at 12:27









          wBobwBob

          6,26631122




          6,26631122












          • Paging @RonDunn - is there an issue with the docs? Does seem to imply ROLLUP is possible.

            – wBob
            Mar 23 at 12:30

















          • Paging @RonDunn - is there an issue with the docs? Does seem to imply ROLLUP is possible.

            – wBob
            Mar 23 at 12:30
















          Paging @RonDunn - is there an issue with the docs? Does seem to imply ROLLUP is possible.

          – wBob
          Mar 23 at 12:30





          Paging @RonDunn - is there an issue with the docs? Does seem to imply ROLLUP is possible.

          – wBob
          Mar 23 at 12:30



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55309756%2fhow-to-use-rollup-grouping-function-error-in-sql-dw%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript