Use a VB Script file to import .DTS files into the local Sql Server database.
'determine current file location
Dim Path: Path=Left(WScript.ScriptFullName,Len(WScript.ScriptFullName)-Len(WScript.ScriptName)-1)'.DTS files to be imported
Dim Sources: Sources = Array("File0.dts","File1.dts")
‘import each file
Dim i
For i = 0 To Ubound(Sources)
Import Path & “\” & Sources(i)
Next
Sub Import(FilePath)
Dim P: Set P = CreateObject(“DTS.Package”)
With P
.LoadFromStorageFile FilePath, “”
‘import to local database, using a trusted connection
.SaveToSQLServer “(local)”, , ,256
End With
Set P = Nothing
End Sub
Hi craig,
I have some interdependant *.DTS files which must not be renamed Like Array File List ( File01, File02..). In such case Would you please give me a complete code of how I can import all the dts files contained in a folder into local database.
Many Thanks in advance for your needful help