Wednesday, March 28, 2012

Job step hanging

Hi,
I am trying to run a VB Script step on A SQL Server 2000
Developer SP3a - OS Win 2000 Professional SP2 and the job
is hanging.
If the same script I am executing from a DTS ActiveX task
it runs without any issue.
Here is the script
Dim fso, Folder, Files, File, datecreated
Set fso = CreateObject("Scripting.FileSystemObject")
'Get handles to folder current location.
Set Folder = fso.GetFolder("E:\Backup_History")
Set Files = Folder.Files
If Files.Count > 0 Then
For Each File In Files
'Get files creation date
MsgBox ( file.DateLastModified)
If file.DateLastModified < date -
7 Then
' Delete the files.
File.Delete
End If
Next
End If
Set fso = Nothing
Set Folder = Nothing
Set Files = Nothing
Set File = Nothing
It meant to delete files older then a week.
Any help is very appreciated.
IonelGet rid of the MsgBox ( file.DateLastModified) :-)
There is no visible desktop to display this message box on so it can never
be acknowledged thus the job hangs
--
HTH
Jasper Smith (SQL Server MVP)
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"Ionel" <anonymous@.discussions.microsoft.com> wrote in message
news:016401c3c3fd$a96226b0$a301280a@.phx.gbl...
> Hi,
> I am trying to run a VB Script step on A SQL Server 2000
> Developer SP3a - OS Win 2000 Professional SP2 and the job
> is hanging.
> If the same script I am executing from a DTS ActiveX task
> it runs without any issue.
> Here is the script
> Dim fso, Folder, Files, File, datecreated
> Set fso = CreateObject("Scripting.FileSystemObject")
> 'Get handles to folder current location.
> Set Folder = fso.GetFolder("E:\Backup_History")
> Set Files = Folder.Files
> If Files.Count > 0 Then
> For Each File In Files
> 'Get files creation date
> MsgBox ( file.DateLastModified)
> If file.DateLastModified < date -
> 7 Then
> ' Delete the files.
> File.Delete
> End If
> Next
> End If
>
> Set fso = Nothing
> Set Folder = Nothing
> Set Files = Nothing
> Set File = Nothing
> It meant to delete files older then a week.
> Any help is very appreciated.
> Ionel
>|||Thanks,
I had several MsgBox that I used for debugging the script.
This one just escape my attention.
Thanks again.
Ionel
>--Original Message--
>Get rid of the MsgBox ( file.DateLastModified) :-)
>There is no visible desktop to display this message box
on so it can never
>be acknowledged thus the job hangs
>--
>HTH
>Jasper Smith (SQL Server MVP)
>I support PASS - the definitive, global
>community for SQL Server professionals -
>http://www.sqlpass.org
>
>"Ionel" <anonymous@.discussions.microsoft.com> wrote in
message
>news:016401c3c3fd$a96226b0$a301280a@.phx.gbl...
>> Hi,
>> I am trying to run a VB Script step on A SQL Server 2000
>> Developer SP3a - OS Win 2000 Professional SP2 and the
job
>> is hanging.
>> If the same script I am executing from a DTS ActiveX
task
>> it runs without any issue.
>> Here is the script
>> Dim fso, Folder, Files, File, datecreated
>> Set fso = CreateObject("Scripting.FileSystemObject")
>> 'Get handles to folder current location.
>> Set Folder = fso.GetFolder("E:\Backup_History")
>> Set Files = Folder.Files
>> If Files.Count > 0 Then
>> For Each File In Files
>> 'Get files creation date
>> MsgBox ( file.DateLastModified)
>> If file.DateLastModified < date -
>> 7 Then
>> ' Delete the files.
>> File.Delete
>> End If
>> Next
>> End If
>>
>> Set fso = Nothing
>> Set Folder = Nothing
>> Set Files = Nothing
>> Set File = Nothing
>> It meant to delete files older then a week.
>> Any help is very appreciated.
>> Ionel
>>
>
>.
>|||I've done the same thing myself :-)
--
HTH
Jasper Smith (SQL Server MVP)
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"Ionel" <anonymous@.discussions.microsoft.com> wrote in message
news:07e701c3c402$e33f6ff0$a001280a@.phx.gbl...
> Thanks,
> I had several MsgBox that I used for debugging the script.
> This one just escape my attention.
> Thanks again.
> Ionel
> >--Original Message--
> >Get rid of the MsgBox ( file.DateLastModified) :-)
> >There is no visible desktop to display this message box
> on so it can never
> >be acknowledged thus the job hangs
> >
> >--
> >HTH
> >
> >Jasper Smith (SQL Server MVP)
> >
> >I support PASS - the definitive, global
> >community for SQL Server professionals -
> >http://www.sqlpass.org
> >
> >
> >"Ionel" <anonymous@.discussions.microsoft.com> wrote in
> message
> >news:016401c3c3fd$a96226b0$a301280a@.phx.gbl...
> >> Hi,
> >>
> >> I am trying to run a VB Script step on A SQL Server 2000
> >> Developer SP3a - OS Win 2000 Professional SP2 and the
> job
> >> is hanging.
> >> If the same script I am executing from a DTS ActiveX
> task
> >> it runs without any issue.
> >>
> >> Here is the script
> >>
> >> Dim fso, Folder, Files, File, datecreated
> >>
> >> Set fso = CreateObject("Scripting.FileSystemObject")
> >>
> >> 'Get handles to folder current location.
> >> Set Folder = fso.GetFolder("E:\Backup_History")
> >>
> >> Set Files = Folder.Files
> >> If Files.Count > 0 Then
> >> For Each File In Files
> >> 'Get files creation date
> >> MsgBox ( file.DateLastModified)
> >> If file.DateLastModified < date -
> >> 7 Then
> >> ' Delete the files.
> >> File.Delete
> >> End If
> >> Next
> >> End If
> >>
> >>
> >> Set fso = Nothing
> >> Set Folder = Nothing
> >> Set Files = Nothing
> >> Set File = Nothing
> >>
> >> It meant to delete files older then a week.
> >>
> >> Any help is very appreciated.
> >>
> >> Ionel
> >>
> >>
> >
> >
> >.
> >

No comments:

Post a Comment