dbTalk Databases Forums  

Database name parameter

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Database name parameter in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Stijn Verrept
 
Posts: n/a

Default Database name parameter - 12-16-2003 , 10:01 AM






I now have this code in Delphi:

{ Create the Ole object.}
OlePack := CreateOleObject('DTS.Package');
{ Load the package.}
OlePack.LoadFromStorageFile('c:\dossier\MedImportH yr.dts', '');
OleTask := OlePack.Tasks.Item(1);
OleCust := OleTask.CustomTask;
OlePack.Execute;

Which runs the MedImportHyr.dts package. This package imports a dBase
V file into the database named Dossier. Now I would like to be able to
say into which database it needs to be put from within the program
(like a parameter). Is this possible? And what do I need to change to
do so?


Thanks in advance,

Stijn Verrept.

Reply With Quote
  #2  
Old   
Darren Green
 
Posts: n/a

Default Re: Database name parameter - 12-16-2003 , 10:25 AM






In article <3fdf2c6a$0$298$ba620e4c (AT) reader0 (DOT) news.skynet.be>, Stijn
Verrept <stijn (AT) no_s (DOT) p.a.n.entrysoft.com> writes
Quote:
I now have this code in Delphi:

{ Create the Ole object.}
OlePack := CreateOleObject('DTS.Package');
{ Load the package.}
OlePack.LoadFromStorageFile('c:\dossier\MedImportH yr.dts', '');
OleTask := OlePack.Tasks.Item(1);
OleCust := OleTask.CustomTask;
OlePack.Execute;

Which runs the MedImportHyr.dts package. This package imports a dBase
V file into the database named Dossier. Now I would like to be able to
say into which database it needs to be put from within the program
(like a parameter). Is this possible? And what do I need to change to
do so?


Thanks in advance,

Stijn Verrept.
There are two places that DB name is normally held for a DataPump task-

The Connection's Catalog property.

The DataPump's SourceObjectName property.

The SourceObjectName is normally a three part name so this overrides the
Catalog anyway, but if you just set a one or two part name for the
SourceObjectName you can just use the Catalog instead.

I don't know Delphi, but something like this should set the
SourceObjectName-

OleTask := OlePack.Tasks.Item("DTSTask_DataPumpTask_1");
OleCust := OleTask.CustomTask;
OleCust.SourceObjectName = "[database].[dbo].[table]"

Make sure the name of the task is correct, I just made one up of
DTSTask_DataPumpTask_1. You could use the ordinal as you have above, but
only if you are sure it will always work. This would be too easy to
break for my liking.


--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org



Reply With Quote
  #3  
Old   
Stijn Verrept
 
Posts: n/a

Default Re: Database name parameter - 12-16-2003 , 07:24 PM



Thank you Darren, I'll try it out!!!


Stijn Verrept.



Darren Green wrote:

Quote:
There are two places that DB name is normally held for a DataPump
task-

The Connection's Catalog property.

The DataPump's SourceObjectName property.

The SourceObjectName is normally a three part name so this overrides
the Catalog anyway, but if you just set a one or two part name for
the SourceObjectName you can just use the Catalog instead.

I don't know Delphi, but something like this should set the
SourceObjectName-

OleTask := OlePack.Tasks.Item("DTSTask_DataPumpTask_1");
OleCust := OleTask.CustomTask;
OleCust.SourceObjectName = "[database].[dbo].[table]"

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.