I have a VBScript that copies a DTS file to the SQL Server when doing an installation. How do I write the line that would check if this package exists alread in the SQL Server and if it exists deletes it and copies the new one?
Right now I have:
' VBScript source code
Const DTSSQLStgFlag_UseTrustedConnection = 256
Dim oPkg, oPkg2
set oPkg = CreateObject("DTS.Package2")
set oPkg2 = CreateObject("DTS.Package2")
oPkg.LoadFromStorageFile ".\UDR.dts", ""
oPkg.SaveToSQLServer "(local)", "", "", DTSSQLStgFlag_UseTrustedConnection
oPkg.UnInitialize
oPkg2.LoadFromStorageFile ".\UDR2.dts", ""
oPkg2.SaveToSQLServer "(local)", "", "", DTSSQLStgFlag_UseTrustedConnection
oPkg2.UnInitialize
Set oPkg = Nothing
Set oPkg2 = Nothing
Right now I have:
' VBScript source code
Const DTSSQLStgFlag_UseTrustedConnection = 256
Dim oPkg, oPkg2
set oPkg = CreateObject("DTS.Package2")
set oPkg2 = CreateObject("DTS.Package2")
oPkg.LoadFromStorageFile ".\UDR.dts", ""
oPkg.SaveToSQLServer "(local)", "", "", DTSSQLStgFlag_UseTrustedConnection
oPkg.UnInitialize
oPkg2.LoadFromStorageFile ".\UDR2.dts", ""
oPkg2.SaveToSQLServer "(local)", "", "", DTSSQLStgFlag_UseTrustedConnection
oPkg2.UnInitialize
Set oPkg = Nothing
Set oPkg2 = Nothing