Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 DTS using ActiveX Script, getting file not found

Author  Topic 

Jmunoz69
Starting Member

6 Posts

Posted - 2010-05-06 : 13:38:45
I am having difficulty correcting error within the ActiveX Script. I know where the problem is, just do not know how to correct.

I am using a global variable to get file path and name, this is where the error is, instead of creating a file, it is looking for file. What do I need to modify to make this script work?

Please help as I am stuck

' File Size
Option Explicit

Function Main()

Dim oFSO
Dim oFile
Dim sSourceFile

Set oFSO = CreateObject("Scripting.FileSystemObject")

sSourceFile = DTSGlobalVariables("SourceFileName").Value

**** THIS IS WHERE THE ERROR OCCURS ****
Set oFile = oFSO.GetFile(sSourceFile)

If oFile.Size > 0 Then
Main = DTSTaskExecResult_Success
Else
Main = DTSTaskExecResult_Failure
End If

' Clean Up
Set oFile = Nothing
Set oFSO = Nothing
End Function


Thanks

Joseph

X002548
Not Just a Number

15586 Posts

Posted - 2010-05-06 : 14:20:53
My Advice...Don't use DTS and write a sproc

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

Jmunoz69
Starting Member

6 Posts

Posted - 2010-05-06 : 17:20:26
Thanks Brett
Go to Top of Page

sathiesh2005
Yak Posting Veteran

85 Posts

Posted - 2010-05-08 : 03:04:13
use oFSO.CreateTextFile(sSourceFile) to create a file.

Regards,
Sathieshkumar. R
Go to Top of Page
   

- Advertisement -