 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
J O Holloway Guest
|
Posted: Wed Aug 13, 2003 4:43 pm Post subject: Re: adding steps/tasks/connections to a DTS package |
|
|
Nevermind, I see it now.
Here's an example, using a pre-saved empty DTS package. It just adds an
Active X Script task, but of course from there you can edit the script or
any of the other settings. The reason a step is added (even for this
one-task package) is because without the step assigned to it a task won't
show in the UI.
FPkg := CoPackage.Create;
FPkg.LoadFromStorageFile(
'\johollowayPinnacleProductsEISRJRloyaltycardFlashFoodssql
stuffdts testTest.dts',
WideString(''), //package password
WideString(''), //package id
WideString(''), //version id
WideString('Test'), //package name
EmptyParam //pVarPersistStgOfHost
);
TheStep := FPkg.Steps.New;
TheTask := FPkg.Tasks.New('DTSActiveScriptTask');
TheTask.Set_Name('DTSTask_DTSActiveScriptTask_1');
TheTask.Set_Description('mundo');
FPkg.Tasks.Add(TheTask);
TheStep.Set_Name('StepOne');
TheStep.Set_TaskName(TheTask.Get_Name);
FPkg.Steps.Add(TheStep);
FPkg.SaveToSQLServer(
'(local)',
WideString('myUser'),
WideString('myPassword'),
DTSSQLStgFlag_Default,
WideString(''), //package owner password
WideString(''), //package operator password
WideString(''), //package category id
EmptyParam, //pVarPersistStgOfHost
TRUE //bReusePasswords
);
|
|
| Back to top |
|
 |
J O Holloway Guest
|
Posted: Wed Aug 13, 2003 6:33 pm Post subject: Re: adding steps/tasks/connections to a DTS package |
|
|
Should have specified the stuff in the var ..
procedure soandso()
var
FPkg : _Package;
cSQL : string;
TheTask : Task;
TheStep : Step;
begin
//code from previous post
end
"J O Holloway" <jholloway (AT) pinncorp (DOT) com> wrote
| Quote: | Nevermind, I see it now.
Here's an example, using a pre-saved empty DTS package. It just adds an
Active X Script task, but of course from there you can edit the script or
any of the other settings. The reason a step is added (even for this
one-task package) is because without the step assigned to it a task won't
show in the UI.
FPkg := CoPackage.Create;
FPkg.LoadFromStorageFile(
'\johollowayPinnacleProductsEISRJRloyaltycardFlashFoodssql
stuffdts testTest.dts',
WideString(''), //package password
WideString(''), //package id
WideString(''), //version id
WideString('Test'), //package name
EmptyParam //pVarPersistStgOfHost
);
TheStep := FPkg.Steps.New;
TheTask := FPkg.Tasks.New('DTSActiveScriptTask');
TheTask.Set_Name('DTSTask_DTSActiveScriptTask_1');
TheTask.Set_Description('mundo');
FPkg.Tasks.Add(TheTask);
TheStep.Set_Name('StepOne');
TheStep.Set_TaskName(TheTask.Get_Name);
FPkg.Steps.Add(TheStep);
FPkg.SaveToSQLServer(
'(local)',
WideString('myUser'),
WideString('myPassword'),
DTSSQLStgFlag_Default,
WideString(''), //package owner password
WideString(''), //package operator password
WideString(''), //package category id
EmptyParam, //pVarPersistStgOfHost
TRUE //bReusePasswords
);
|
|
|
| Back to top |
|
 |
Jeremy Collins Guest
|
Posted: Thu Aug 14, 2003 10:52 am Post subject: Re: adding steps/tasks/connections to a DTS package |
|
|
J O Holloway wrote:
| Quote: | Does anyone know how to add tasks & steps and/or connections to an existing
DTS package?
I've figured out how to modify steps/tasks/connections, and how to use DTS
jobs as either structured storage files or as packages saved to SQL Server.
As well I've figured out how to do some interesting stuff like use a DTS
package to get information about a scheduled job and modify that job's
settings. What I have not been able to figure out is how to modify a DTS
package in the sense of adding a task/step or adding connection.
Any help would be much appreciated.
|
Something like this maybe (I've only done DTS modification stuff in
VB)...
uses DTS_TLB;
var
pkg : Package;
cnn : Connection;
begin
pkg := CoPackage.Create;
:
cnn := pkg.Connections.New('SQLOLEDB.1');
cnn.DataSource := 'some_db_info';
:
pkg.SaveToSQLServer(...)
end;
Same with tasks I guess.
--
jc
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|