-1

There is a software (called StackVision) that uses "SQL Server Reporting Services" for creating some reports. More information about the software is here.

I am trying to make a new "View" out of a couple of "Stored Procedures" in the database. I do not want to mess with the stored procedure coding though. I just want to run a code to build a new "View" out of the results of "Stored Procedures." The following code can run one of the desired stored procedures.

EXECUTE [dbo].[ss_Total]

@StartDate ='07/1/2020'
, @EndDate='09/30/2020 23:59'
, @ParameterA='AA'
, @ParameterB='BB'
,@INterval = '001H'

Does anyone know who I can execute the following "Stored Procedure" only on last quarter. Instead of putting a certain date (such as '07/1/2020' and '09/30/2020 23:59'), I would like to have a coding that tells the stored procedure to be conducted from the beginning of last quarter to the end of last quarter. Assume that the date is 10/2/2020.

BTW, the software also run the stored procedures to create some reports.

The reason that I am doing this: I built a Power BI report by connecting the Power BI report to the Stackvision server. The Power BI report, calls/runs the stored procedures and then append/merge tables to create a report. Unfortunately, the Power BI server fails to refresh the data. So, I am thinking to create one "view" in the database and only pull that view into Power BI. Then the Power BI server will not time out and will not fail anymore.

  • 1
    See if this helps. https://stackoverflow.com/questions/18844218/get-quarters-startdate-and-enddate-from-year – SS_DBA Oct 02 '20 at 19:56
  • 1
    Which dbms are you using? (That code is product specific.) – jarlh Oct 02 '20 at 20:10
  • 1
    The description of the SQL tag says that you should also include a tag for the specific DBMS you're using, as syntax and functionality between them varies. It's impossible to provide an answer to your question until you [edit] to add that tag, because it's a waste of time to write an answer only to find out it won't work on the DBMS you're using. Always provide the relevant information when posting to save both your time and ours. – Ken White Oct 02 '20 at 20:22
  • @KenWhite I tried to edit the question as much as I can. Thanks. – Pouyan Ebrahimi Oct 03 '20 at 02:48
  • @KenWhiteAny comment on my question? – Pouyan Ebrahimi Oct 05 '20 at 12:33

1 Answers1

-1

You can add the date 3 months from your initial param. here the link:

https://www.w3schools.com/sql/func_sqlserver_dateadd.asp

I don't know what your DB using, if you using MySQL try this for example

SELECT ADDDATE(NOW(), 90) as datethis
  • It is not a table to allow using SELECT ADDDATE... It is a STORED PROCEDURE. So, I should use something in front of all parameters including StartDate, EndDate and so on. – Pouyan Ebrahimi Oct 02 '20 at 20:24
  • The poster has indicated that the code is for a stored procedure, not a simple `SELECT`. They've also added a tag for SQL Server, which means a MySQL answer isn't the solution. – Ken White Oct 03 '20 at 03:23
  • ohhh yeaahh. sorry for the mysql part @KenWhite – Arief Novanda Zulvan Oct 04 '20 at 17:18