Link to home
Create AccountLog in
Avatar of AlHal2
AlHal2Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Run job from when last one finished.

I have an SQL table which has a maintdate and marinttime field.  The maintdate field shows the day when row was updated or created.  The mainttime shows the time.

I want to download data from this table during the day.  However I only want rows that were created or updated since the job last ran.  How can I do this.

I thought of using the maintdate and mainttime fields and somehow storing the date and time that the job last ran.  I don't know how to find the date and time the job last ran and incorporate that into an SQL query.
Avatar of chapmandew
chapmandew
Flag of United States of America image

Add your field for the date the job ran.  in your job steps, add code to update that field for the records modified by the job.  Then you will know when they were updated.
Avatar of AlHal2

ASKER

The job does not modify any data.  It extracts data from the database, so it can be sent to a client.
Make it so that it updates the records that it sends....updates the date it sends them out.
Avatar of AlHal2

ASKER

I need those fields to stay as they are.  They are used for other purposes.  Rather than updating any data in the database is it possible to find the date and time the job last ran, store it and incorporate that into an SQL query.
ASKER CERTIFIED SOLUTION
Avatar of chapmandew
chapmandew
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of AlHal2

ASKER

Thanks.