within DTS.
However, if I run it as a sheduled job, it fails with a 'path not
found error'. I've cut the code down to the approriate problem and
posted it here, it just makes a simple text file with a name derived
from the current date and time and puts 'Hello World' in the file
although in reality I go on to make an xml file. (make sure your path
exists before you execute it). Why does the scheduled job not execute
this simple task. I have loads of other jobs that run packages to a
schedule and the account is a domain account with windows
administrative rights.
'******************************
' Visual Basic ActiveX Script
'**********************
Const strPath="d:\xml"
Private Function GetDateTime()
Dim strNow, stryear, strMonth, strDay, strTime
strNow = Now
stryear = Mid(strnow, 7, 4)
strMonth = Mid(strnow, 4, 2)
strDay = Left(strnow, 2)
strTime = Replace(Mid(strnow, 12, 8), ":", "")
GetDateTime = stryear + strMonth + strDay + strTime
End Function
Function Main()
Dim fso,f,MyFile 'file objects
Set fso = CreateObject("Scripting.FileSystemObject")
dim strRightNow
strRightNow=GetDateTime()
Set MyFile= fso.CreateTextFile(strPath &"\" & "UPD-"
& strRightNow & ".txt", True) 'This line fails from a scheduled job
MyFile.WriteLine("Hello World")
MyFile.Close
Main = DTSTaskExecResult_Success
End Function
'Error Source= Microsoft VBScript runtime error Error Description:
Path not found Error on Line 25"TiredOfSpam" <spam@.drmcl.free-online.co.uk> wrote in message
news:403767a1.0410080148.b529ff@.posting.google.com ...
>I have an ActiveX Script task in a DTS package which executes fine
> within DTS.
> However, if I run it as a sheduled job, it fails with a 'path not
> found error'. I've cut the code down to the approriate problem and
> posted it here, it just makes a simple text file with a name derived
> from the current date and time and puts 'Hello World' in the file
> although in reality I go on to make an xml file. (make sure your path
> exists before you execute it). Why does the scheduled job not execute
> this simple task. I have loads of other jobs that run packages to a
> schedule and the account is a domain account with windows
> administrative rights.
> '******************************
> ' Visual Basic ActiveX Script
> '**********************
> Const strPath="d:\xml"
> Private Function GetDateTime()
> Dim strNow, stryear, strMonth, strDay, strTime
> strNow = Now
> stryear = Mid(strnow, 7, 4)
> strMonth = Mid(strnow, 4, 2)
> strDay = Left(strnow, 2)
> strTime = Replace(Mid(strnow, 12, 8), ":", "")
> GetDateTime = stryear + strMonth + strDay + strTime
> End Function
> Function Main()
> Dim fso,f,MyFile 'file objects
> Set fso = CreateObject("Scripting.FileSystemObject")
> dim strRightNow
> strRightNow=GetDateTime()
> Set MyFile= fso.CreateTextFile(strPath &"\" & "UPD-"
> & strRightNow & ".txt", True) 'This line fails from a scheduled job
> MyFile.WriteLine("Hello World")
> MyFile.Close
> Main = DTSTaskExecResult_Success
> End Function
> 'Error Source= Microsoft VBScript runtime error Error Description:
> Path not found Error on Line 25
Assuming that D: is a local drive (ie. not mapped to a network share), I can
reproduce your error using the code sample, but I have no idea what the
solution is. Usually, this comes down to a problem of ownership and/or
permissions:
http://support.microsoft.com/?kbid=269074
However, even with both the package and the job owned by the same account (I
tried using both sa and a domain admin account in the sysadmin role), and
with the NTFS permissions of the target folder set to allow Everyone to
create a new file, the scheduled job still failed.
You might want to post this in microsoft.public.sqlserver.dts - you may get
a more useful answer there.
Simon
No comments:
Post a Comment