Hi,
I'm having some trouble debugging the following script i used from sqldts.com.
----------------------------------------------------------------------------------------
' 246 (DefineTheGVs)
Option Explicit
Function Main()
Dim fso
Dim fold
Dim pkg
Dim stpContinuePkg
Dim stpExitbadDirectory
' First thing we need to do is to check if our directories are valid.
SET pkg = DTSGlobalVariables.Parent
SET stpContinuePkg = pkg.Steps("DTSStep_DTSActiveScriptTask_3")
SET stpExitBadDirectory = pkg.Steps("DTSStep_DTSActiveScriptTask_2")
DTSGlobalVariables("gv_FileCheckErrors").Value = ""
'We use the FileSystemObject to do our
'Folder manipulation
set fso = CREATEOBJECT("Scripting.FileSystemObject")
'Here we check to make sure the Source folder for the files exists
if fso.FolderExists(DTSGlobalVariables("gv_FileLocation").Value) <> "True"
then
DTSGlobalVariables("gv_FileCheckErrors").Value =
CSTR(DTSGlobalVariables("gv_FileCheckErrors").Value) &_
" " & "Source File directory Not Found"
end if
'Here we check to make sure the Archive folder for the files exists
if fso.FolderExists(DTSGlobalVariables("gv_ArchiveLocation").Value) <>
"True" then
DTSGlobalVariables("gv_FileCheckErrors").Value =
CSTR(DTSGlobalVariables("gv_FileCheckErrors").Value) &_
" " & "Archive File directory Not Found"
end if
'We predefined the GlobalVariable gv_FileCheckErrors = "" which
'has a length of 2 so we check to see if it has expanded. If it has then
we
'know we had an error and we disable the step that would
'allow us to continue in the package and enable the step
'that takes us out and handles the errors we encountered
If len(DTSGlobalVariables("gv_FileCheckErrors").Value) > 2 Then
stpContinuePkg.DisableStep = True
stpExitBadDirectory.DisableStep = False
Else
stpContinuePkg.DisableStep = False
stpExitBadDirectory.DisableStep = True
end if
Main = DTSTaskExecResult_Success
End Function
-----------------------------------------------------------------------------------------
The script is part of dts package in sql server. The package
imports files and archive them into another directory.
The problem is when i run the package it fails at above mentioned script.
The error i'm getting says that the source and archive folders are not found
even if i know for certain that they exists. The paths to the files are set
in a global variable which one can insert in the property page of the dts.
Even when the correct paths are set up, the script fails.
I tried to figure it out (there are no debugtools in dts for vbscript), so i
removed the folder checks and it works. All files are imported into the
database.
So my question is what is wrong with this picture?
I'm having some trouble debugging the following script i used from sqldts.com.
----------------------------------------------------------------------------------------
' 246 (DefineTheGVs)
Option Explicit
Function Main()
Dim fso
Dim fold
Dim pkg
Dim stpContinuePkg
Dim stpExitbadDirectory
' First thing we need to do is to check if our directories are valid.
SET pkg = DTSGlobalVariables.Parent
SET stpContinuePkg = pkg.Steps("DTSStep_DTSActiveScriptTask_3")
SET stpExitBadDirectory = pkg.Steps("DTSStep_DTSActiveScriptTask_2")
DTSGlobalVariables("gv_FileCheckErrors").Value = ""
'We use the FileSystemObject to do our
'Folder manipulation
set fso = CREATEOBJECT("Scripting.FileSystemObject")
'Here we check to make sure the Source folder for the files exists
if fso.FolderExists(DTSGlobalVariables("gv_FileLocation").Value) <> "True"
then
DTSGlobalVariables("gv_FileCheckErrors").Value =
CSTR(DTSGlobalVariables("gv_FileCheckErrors").Value) &_
" " & "Source File directory Not Found"
end if
'Here we check to make sure the Archive folder for the files exists
if fso.FolderExists(DTSGlobalVariables("gv_ArchiveLocation").Value) <>
"True" then
DTSGlobalVariables("gv_FileCheckErrors").Value =
CSTR(DTSGlobalVariables("gv_FileCheckErrors").Value) &_
" " & "Archive File directory Not Found"
end if
'We predefined the GlobalVariable gv_FileCheckErrors = "" which
'has a length of 2 so we check to see if it has expanded. If it has then
we
'know we had an error and we disable the step that would
'allow us to continue in the package and enable the step
'that takes us out and handles the errors we encountered
If len(DTSGlobalVariables("gv_FileCheckErrors").Value) > 2 Then
stpContinuePkg.DisableStep = True
stpExitBadDirectory.DisableStep = False
Else
stpContinuePkg.DisableStep = False
stpExitBadDirectory.DisableStep = True
end if
Main = DTSTaskExecResult_Success
End Function
-----------------------------------------------------------------------------------------
The script is part of dts package in sql server. The package
imports files and archive them into another directory.
The problem is when i run the package it fails at above mentioned script.
The error i'm getting says that the source and archive folders are not found
even if i know for certain that they exists. The paths to the files are set
in a global variable which one can insert in the property page of the dts.
Even when the correct paths are set up, the script fails.
I tried to figure it out (there are no debugtools in dts for vbscript), so i
removed the folder checks and it works. All files are imported into the
database.
So my question is what is wrong with this picture?