dbTalk Databases Forums  

Dynamically Changing Filepath?

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


Discuss Dynamically Changing Filepath? in the microsoft.public.sqlserver.dts forum.



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

Default Dynamically Changing Filepath? - 05-10-2005 , 03:51 PM






Hello,

I have a dts package that pulls data from a .csv file and then scrubs and
loads it into a table. Is there a way to change the file path and/or name
using t-sql prior to executing the package?

Any help would be greatly appreciated!
Thanks in advance.

Reply With Quote
  #2  
Old   
Helge C. Rutz
 
Posts: n/a

Default Re: Dynamically Changing Filepath? - 05-10-2005 , 04:16 PM






Hi Mark,

"Mark" <Mark (AT) discussions (DOT) microsoft.com> schrieb im Newsbeitrag
news:4CCDB835-EBA2-44E8-A92B-9B1C0327419A (AT) microsoft (DOT) com...
Quote:
Hello,

I have a dts package that pulls data from a .csv file and then scrubs and
loads it into a table. Is there a way to change the file path and/or
name
using t-sql prior to executing the package?
you can simply use the dynamic properties task inside of the dts package to
change the filepath before importing the data.
You can read it from an ini file or query a database or maybe pass it as
variable to the package.
Depending on usage and invokation of the package one way might be prefered.

Helge




Reply With Quote
  #3  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Dynamically Changing Filepath? - 05-10-2005 , 04:42 PM



You can use a Dynamic Properties task but you can also use something
like this

How can I change the filename for a text file connection?
(http://www.sqldts.com/default.aspx?200)



"Mark" <Mark (AT) discussions (DOT) microsoft.com> wrote


Quote:
Hello,

I have a dts package that pulls data from a .csv file and then scrubs and
loads it into a table. Is there a way to change the file path and/or name
using t-sql prior to executing the package?

Any help would be greatly appreciated!
Thanks in advance.


Reply With Quote
  #4  
Old   
Mike Gercevich via SQLMonster.com
 
Posts: n/a

Default Re: Dynamically Changing Filepath? - 05-13-2005 , 06:35 AM



if you load the package and have the package use a global variable as the
path location, you would be able to modify the global variable prior to
calling the DTS Package's Execute() Method.

DTSRUN also has a command line parameter to set Global Variables prior to
the call to Execute().

-Mike Gercevich

--
Message posted via http://www.sqlmonster.com

Reply With Quote
  #5  
Old   
Mike Gercevich via SQLMonster.com
 
Posts: n/a

Default Re: Dynamically Changing Filepath? - 05-13-2005 , 06:40 AM



If you wanted to do this by only using T-Sql, you would have to load the
DTS Package2 object using the _OA methods in a stored procedure and call
the Execute() method on the object. If your package takes longer than 60
seconds to run, you may have to work through some timeout issues. This is
not a very graceful solution, and there are much better ways to yield the
same results.

-Mike Gercevich

--
Message posted via http://www.sqlmonster.com

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.