How to create a job in SQL Developer in CST timing? - sql

I have a procedure named sales_update which updates a table named sales_entry. I need to create a job in SQL DEVELOPER VERSION 2.1.0. The job needs to be created in CST timing daily # 8 am so as the table sales_entry gets updated by 8 am CST.
How do I do that?

https://docs.oracle.com/database/121/ADMIN/scheduse.htm#ADMIN034
Try the link above; basically all you need to do is use the query
DBMS_SCHEDULER.CREATE_JOB(
)

Related

Last run date of a view and triggers

Is it possible to find the run date of view and triggers in SQL Server? We have a script for procedures but not views and triggers. We need this to create a report of the last run date of the objects in the production.
This can also be achieved by using a server side trace
https://www.sqlservercentral.com/blogs/setting-up-a-server-side-trace

How to know the latest stored procedure affecting a rows of a table and when?

I have a temp table that is affected by various Stored procedures and wanted to know what the latest SP that affected the table and when.
There is some internal log or query that can bring me an approximate result in SQL server?
Ex:
Here Temporary_summ is my table and below is the format i am expecting..
tablename spname lastaccessedtime
temporary_summ --- sp_math_cal --------- 2016-05-30 12:05:22
temporary_summ --- sp_weather_calc ---- 2016-05-30 12:06:34
You can capture the activity on a server using SQL Server Profiler.
It creates a log since you start running it. It is just for capture when needed (Ex.: debugging), so it doesn't consume the server resources.

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())

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.

SQL Server Agent Job for the first 4 days of Month

I was wondering if anyone knew how to create a job that will run the first 4 days of the month in SQL Server 2000? I found how to run a job once on the first or second day, but the only way I figured I could run each of the four days would be to create a job for each day meaning I would have 4 jobs created. I was hoping for a better way.
Instead of creating 4 jobs, you can create one job with 4 schedules.
Fire up enterprise manager, create your job as you normally would and on the schedules tab of the Job properties add 4 schedules, one for each day of the month you'd like the job to run.
Sorry I don;t have SQL 2000 to hand but can you not once the job is created add 4x schedules to the job (Edit Job > New Schedule or similar)
Sorry if this isn't available, you can use this method in 2008
he he, As Jason says