It is currently 12 Dec 2017 7:21


Post new topic  Reply to topic  [ 1 post ] 
Author Message
PostPosted: 10 Jan 2006 6:00 
Offline
Nouveau
Nouveau
User avatar

Joined: 26 Apr 2005 12:00
Posts: 696
Location: PARIS
That SQL script could be executed with Control-M Database.

set nocount on
go
declare @limittime varchar ( 8 )
declare @timetest varchar( 6 )
select @limittime=(convert(varchar(20), dateadd(hh,-2,getdate()),108))
select @limittime
select @timetest=(substring (@limittime,1,2)+substring (@limittime,4,2)+substring (@limittime,7,2))
select @timetest

select CMR_AJF.JOBNO, CMR_IOALOG.LOGDATE, CMR_AJF.JOBNAME, CMR_AJF.HOLDFLAG, CMR_IOALOG.LOGTIME
into #forgroupby
from CMR_AJF, CMR_IOALOG
where CMR_AJF.JOBNO=CMR_IOALOG.JOBNO and CMR_IOALOG.MSGID='5401' and CMR_AJF.HOLDFLAG='Y'
ORDER by CMR_IOALOG.LOGDATE,CMR_IOALOG.LOGTIME

select JOBNO, LOGDATE,JOBNAME, HOLDFLAG, max(LOGTIME)
from #forgroupby where LOGTIME < @timetest
group by JOBNO, LOGDATE, JOBNAME, HOLDFLAG

drop table #forgroupby


In case of you want to extract jobs helded since 2 hours for example, you just need to modify the following line :


select @limittime=(convert(varchar(20), dateadd(hh,-2,getdate()),108))



Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 1 post ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited
The site created by Franck YOT. Images, logo, content and trademarks about Control-M products are property of BMC Software.
All the comments are property of their posters. Images, logo, content and design are © copyright by Scheduler-Usage.com. All Rights Reserved