Page 1 of 1

How to get previous timestamp field

Posted: Mon Aug 25, 2008 1:11 am
by monaz
Hi all is there any way which i can get previous timepstamp for the field.

Example In a table i have a field Last_upt_tmpst with this field i need to put constraint in my job as last_upt_tmpst> @previous_upt_tmpst

But i dont want to declare variable as @previous_upt_tmpst..

Is there any way which i can get by any Convert function.

Please help me on this.

Posted: Mon Aug 25, 2008 1:17 am
by ray.wurlod
Use stage variables to "remember" the previous value (that is, the value in the previous row). What does "previous" actually mean in your context?

Posted: Mon Aug 25, 2008 2:12 am
by monaz
for example i am running a job(25th) and i need to extract data of 24th from the table AB with field lst_updt is a timestamp field.

How can i proceed with this

Posted: Mon Aug 25, 2008 2:18 am
by ray.wurlod
So you need the equivalent of the timestamp of this time on the previous day to a particular timestamp? Download the routines from this site and you will find one (AddDaysToTimestamp) that does timestamp arithmetic. Use -1 as the Days argument.

Posted: Mon Aug 25, 2008 7:23 am
by chulett
Sounds like you need to create a job to capture this 'lst_updt' and stash it somewhere like USERSTATUS. Then use a Sequence job to run the two Server jobs and pass it as a Job Parameter to the second job. Use the job parameter in the constraint.