Quantcast
Viewing all articles
Browse latest Browse all 38722

Forum Post: RE: Using parameter to determine content of column is SRSS

thank you for the suggestion. Based on what you said I modified the view and saved it as a stored procedure. When I set the variables in MS and execute the query from there it produces the desired results. However when I use the stored procedure from an SRSS report I get an error saying to enable remote errors for more info. When it is enabled I still get the same error. Interestingly enough it works when I remove the declare statement and cut/paste the query into the SRSS report. Thanks again for your assistance! CREATE PROCEDURE SP_VIEW_SALES_BY_CUSTOMER_MONTH_2 AS declare @Period1 varchar(30), @Period2 varchar(30) select d.CUSTNMBR Customer_ID, d.CUSTNAME Customer_Name, sum(case when month(d.DOCDATE) = @Period1 then d.SALES else 0 end) SalesPeriod1, sum(case when month(d.DOCDATE) = @Period2 then d.SALES else 0 end) SalesPeriod2, sum(d.SALES) Yearly_Total from (select s.DOCDATE, s.CUSTNMBR, c.CUSTNAME, case s.SOPTYPE when 3 then s.DOCAMNT when 4 then s.DOCAMNT*-1 end SALES from SOP30200 s left outer join RM00101 c on s.CUSTNMBR = c.CUSTNMBR where s.VOIDSTTS = 0 and s.SOPTYPE in (3,4) and year(s.DOCDATE) = 2015 ) d group by d.CUSTNMBR, d.CUSTNAME

Viewing all articles
Browse latest Browse all 38722

Trending Articles



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