Quantcast
Channel: VMware Communities : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 176483

converting tsql stored procedure syntax issue

$
0
0

I have a couple of tsql stored procedures that I'm having problems converting from the pubs example delivered with SqlServer.  How do we translate these stored procedures:

 

CREATEPROCEDURE reptq1 AS

select

  case when grouping(pub_id) = 1 then'ALL' else pub_id endas pub_id,

  avg(price) as avg_price

from titles

where price isNOTNULL

groupby pub_id with rollup

orderby pub_id

 

select

  case when grouping(type) = 1 then 'ALL' else type end as type,

  case when grouping(pub_id) = 1 then 'ALL' else pub_id end as pub_id,

  avg(ytd_sales) as avg_ytd_sales

from titles

where pub_id is NOT NULL

group by pub_id, type with rollup

 

The issue is group by with rollup that's throwing me.


Viewing all articles
Browse latest Browse all 176483

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>