Hyperion Reporting - Query for prior day (DB2 and Oracle) - sql

I am using Hyperion Reporting Studio. I have a report where I want to calculate the turn around time for messages that come in to my department.
I need to find a way, whether it's custom SQL or just a feature for the report to always pull the data from the prior day. I have an Open_Date filter where the setting is > 06/06/16 12:00 AM.
However I will always need the date to be the day prior to the current one. I will be using EPM which allows you to setup recurring reports, that run then get emailed to you on a daily basis, automatically. I need to figure out some custom SQL Hyperion can use in my date field and have not found any solutions.
Additional info: Using Hyperion Interactive Reporting Studio; DB2 and Oracle Databases.

It depends on your backend (DB2 or Oracle) which syntax you use. Also, do you want "yesterday" relative to the user, or to the server? Assuming the latter, because this sounds like a job on the server.
I think what you're looking for is:
CURRENT DATE for DB2 and
SYSDATE for Oracle
These are the equivalent of "today" relative to the server's date and time. Will the job run after midnight? It might be as simple as adding -1 but you could run into trouble if the job runs before midnight sometimes, and after midnight other times (don't know what would happen if the job ran through midnight).

Related

How to calculate the next run date for a SQL Server agent job

I am developing a custom system for scheduling task & I am following Microsoft SQL Server Agent approach to schedule task.
I have replicated sysschedules table for capturing users scheduling occurrences and timings.
Now I need to know how SQL Server get the Next_run_date and time from this table.
I have found a solution on the internet which are using sysjobhistory table to get the next run date, but in my case, I have an only sysschedules table. So, what is the formula to calculate the next_run_date and time for any job?
Note: I am looking for entire code, concept/algorithm will work for me.

How to change a column value based on date (every year)

I am working on a leave management system, and this is my first web application. I have a LocalDB sql server in visual studio 2010 and I need some columns to be updated every year.
For example, I have SickLeave column (int), I need this column to be updated with the value (15) in a specific date (every year), the date will be different from one employee to another based on his joining date.
I have searched a lot, there is something called scheduled event in mySQL that can do something similar, but it doesn't work for sql server.
So anyone has an idea how to do it? Your help will be appreciated.
Thanks in advance.
You can use a SQL Agent Job.
SQL Agent: https://msdn.microsoft.com/en-us/library/ms189237.aspx
Create a Job: https://msdn.microsoft.com/en-us/library/ms190268.aspx
We use these for all sorts of scheduled tasks.
In your case you could create Job that runs Daily, the job can execute a StoredProc (or simple Update statement).
UPDATE Employee SET SickLeave = 15 WHERE DAY(JoinedDate) = DAY(GETDATE()) AND MONTH(JoinedDate) = MONTH(GETDATE())

View the waiting/suspended queries between a time period in the past

I am trying to optimize an SQL process using the dmv ([sys].[dm_os_wait_stats]).
Is there any way that we can see the waiting/suspended queries between a time period in the past?. Like want to have records only from 3pm today.
Currently I clean the instance every time before running the process using
DBCC SQLPERF ('sys.dm_os_wait_stats', CLEAR);
GO
I suggest that using monitoring tools such as Idera or Redgate monitor in order to monitor sql server waiting. You can also copy ([sys].[dm_os_wait_stats]) data in other table periodically.

create ms sql server job schedule from datetime database

I'm using microsoft SQL server management studio 2005
I'm trying to run a job at a specific time and that time is stored in a database.
I can't insert the schedule manually because it is up to the user to decide what date and time the job(s) has to be done. php collects the time and date and sends it to a database.
I thought about runing a job every min and in my execution I have an if statement that only activates when the datetime stored in the database is one minute greater or lower than the current datetime. but doing it like this would be inaccurate and very inefficient. would it be possible to create a schedule directly from a query or job?
You can create and modify both jobs and schedules programmatically using SMO or TSQL. That means you can use an external application, a stored procedure or a trigger to create or update a job schedule based on the table data. SMO is probably the best way to go if you want to build an application to manage jobs, but on the other hand it's .NET only.

SSIS 2005 - How to figure out what job a sysdtslog90 entry was run under?

Given a entry in a sysdtslog90 table in SQL Server 2005 from an SSIS package, how do you figure out what database agent job the entry was run under?
It looks like, after many tests and examination of the data generated, you should be able to piece out this information for your environment(s) from a mix of the computer, operator, and source columns, and maybe the sourceid if that remains consistant between restarts of SQL Agent. Deriving it by correlating between job run times and the starttime and endtime column is also possible, and even more complex options could be worked through setting the value in the datacode column (however that may be done).
I no longer have anything to do with DTS packages, and so do not have (and cannot generate) any such sample data and provide a better answer. (I'd have made this a comment, but no one else has replied yet, so I'm making it a bit more formal.)