Showing posts with label vbscript. Show all posts
Showing posts with label vbscript. Show all posts

Sunday, March 11, 2012

Calling a DTS (SSIS 2005) from a Vbscript

Hello,

I would like to run a DTS using a Vbscript, i managed to get the DTS running, but i would like to pass the value of a global variable, but im having lots of dificulties.

Since it is a VBS i only have access to the things registered on the registry of the machine, so i don't have access to the microsoft.sqlserver.dts.runtime, at is maximum.

So i do the following

Set objApplication = CreateObject("MSDTS.Application")

Set objDTSPackage = objApplication.LoadPackage("T.dtsx", True, Nothing)

'This should pass the variable but insted i have an error

set pkgVars = objDTSPackage.Variables

set myVar = objDTSPackage.Variables.Add("User::Name", false, "User", "TesteA")

'End of the error part

DTSResults = objDTSPackage.Execute()

The error that i got is the following

"Object doesn't support object or method"

What am i doing wrong?

Thank you

Nuno Ferreira

this link might help: http://msdn2.microsoft.com/en-us/library/ms136090.aspx|||

This link refers the use of microsoft.sqlserver.dts.runtime.

What happens is that since im using Vbscript, i do not have access to microsoft.sqlserver.dts.runtime. Is there a way to create the object from microsoft.sqlserver.dts.runtime in the script?

If not how can i in the script assign a variable value to the DTS

|||

hi,

It was very useful have any link with that information. I am pursuing for any sort of stuff like that too.

regards,

|||

Nfrf wrote:

This link refers the use of microsoft.sqlserver.dts.runtime.

What happens is that since im using Vbscript, i do not have access to microsoft.sqlserver.dts.runtime.

the ssis assemblies are managed wrappers for com objects.

Is there a way to create the object from microsoft.sqlserver.dts.runtime in the script?

yes. you need to figure out the progid for the object that you wish to create. this can be accomplished by looking in the registry.

|||

I have run SSIS packages in a Batch file using a Scheduled Task and it's much less complicated than trying to use VB, here is an example:

dtexec.exe /file F:\SSIS_Packages\MyPackage1.dtsx /MAXCONCURRENT " -1 " /CHECKPOINTING OFF
dtexec.exe /file F:\SSIS_Packages\MyPackage2.dtsx /MAXCONCURRENT " -1 " /CHECKPOINTING OFF
dtexec.exe /file F:\SSIS_Packages\MyPackage3.dtsx /MAXCONCURRENT " -1 " /CHECKPOINTING OFF
dtexec.exe /file F:\SSIS_Packages\MyPackage4.dtsx /MAXCONCURRENT " -1 " /CHECKPOINTING OFF

Optional Switches:

Options are case-insensitive.
A hyphen (-) may be used in place of a forward slash (/).
/CheckF[ile] [Filespec]
/Checkp[ointing] [{On | Off}] (On is the default)
/Com[mandFile] Filespec
/Conf[igFile] Filespec
/Conn[ection] IDOrName;ConnectionString
/Cons[oleLog] [[DispOpts];[{E | I};List]]
DispOpts = any one or more of N, C, O, S, G, X, M, or T.
List = {EventName | SrcName | SrcGuid}[;List]
/De[crypt] Password
/DT[ S] PackagePath
/F[ile] Filespec
/H[elp] [Option]
/L[ogger] ClassIDOrProgID;ConfigString
/M[axConcurrent] ConcurrentExecutables
/P[assword] Password
/Rem[ark] [Text]
/Rep[orting] Level[;EventGUIDOrName[;EventGUIDOrName[...]]
Level = N or V or any one or more of E, W, I, C, D, or P.
/Res[tart] [{Deny | Force | IfPossible}] (Force is the default)
/Set PropertyPath;Value
/Ser[ver] ServerInstance
/SQ[L] PackagePath
/Su[m]
/U[ser] User name
/Va[lidate]
/VerifyB[uild] Major[;Minor[;Build]]
/VerifyP[ackageid] PackageID
/VerifyS[igned]
/VerifyV[ersionid] VersionID
/W[arnAsError]

|||

Thanks this could be of help.

One other thing. And if you like to pass a variable in the command line how do you do it?

Thanks

Calling a Data Pump task from DTS?

I have a vbscript to read all files from a directory and, if the file
is valid, I would like my DTS to process it. I tried using the
vbscript as an ActiveX workflow script in the DTS, but it does not
execute the data pump until it has completed looping through all the
files, so only the last file read is sucked into the database
(utilizing a global variable as the filename). Is there a way to
execute the data pump task from within the activex script? I can't
seem to find any documentation about executing a DTS task.

Basically, the workflow I want is:

1)Read files from directory (the number and names may change each
time). (done with vbs)

2)For each file, send it through the transformation into the database.

3)When the information is in the database, append a date to the file
and move it to the archive folder. (done with vbs)

If I am going about this the wrong way and you see something that is
not obvious to me, please let me know.

Thanks in advance!Hi

This may help:
http://www.sqldts.com/default.aspx?246

John

<noelle.bond@.gmail.com> wrote in message
news:1128110995.716126.283160@.g47g2000cwa.googlegr oups.com...
>I have a vbscript to read all files from a directory and, if the file
> is valid, I would like my DTS to process it. I tried using the
> vbscript as an ActiveX workflow script in the DTS, but it does not
> execute the data pump until it has completed looping through all the
> files, so only the last file read is sucked into the database
> (utilizing a global variable as the filename). Is there a way to
> execute the data pump task from within the activex script? I can't
> seem to find any documentation about executing a DTS task.
> Basically, the workflow I want is:
> 1)Read files from directory (the number and names may change each
> time). (done with vbs)
> 2)For each file, send it through the transformation into the database.
> 3)When the information is in the database, append a date to the file
> and move it to the archive folder. (done with vbs)
> If I am going about this the wrong way and you see something that is
> not obvious to me, please let me know.
> Thanks in advance!|||Thanks so much! I'll give it a try.|||noelle.bond@.gmail.com wrote:

> Thanks so much! I'll give it a try.

Just be forewarned, the DTS designer has a big disconnect between what
it shows you as the name of a DTS step and what actually needs to be
used in your VBScript code to refer to it as...