Groups | Blog | Home
all groups > sql server dts > july 2003 >

sql server dts : Vbscript question in SQL DTS


Steve Chatham
7/30/2003 11:31:36 AM
In trying to make some changes to a file extract (we are pulling a text file
from another domain into the one our SQL server is in, and then loading a
database from it), we will have the need to "bind" the sets of text files
together.

In other words, for me to know which orderfile goes with which credit file
and shipment files, they'll all have the date appended to the files.

The way it is now, we get:

orderfile.txt which would be named orderfile20030731.txt in the proposed
changes.

tomorrows would be named orderfile20030801.txt and so on.

The other text files would be named in a corresponding manner, so that a
load of creditfile0731 isn't mixed with an orderfile of 0801.

I need to put a step into our existing DTS jobs to take the file, no matter
what the name is, and to rename it (or copy it) to our old filename and have
it be input to the DTS job. Either that, or make the DTS job pick up the
appropriate name.

To complicate matters, we run one database server on monday-wednesday &
friday, and another on tuesday-thursday-saturday.

Is there a way to do this in VBscript from within the DTS job? If so, how?

Any advice appreciated.

Thanks,

Steve

Darren Green
7/30/2003 5:20:38 PM
You can use an ActiveX SCript Task. Try these articles-

Working with files and the FileSystemObject
http://www.sqldts.com/default.aspx?6,101,292,0,1

How can I change the filename for a text file connection?
http://www.sqldts.com/default.aspx?6,101,200,0,1


--
Darren Green
http://www.sqldts.com

[quoted text, click to view]

grapevine
7/30/2003 7:01:02 PM

I have done the same thing in a ActiveX Task. Use the FileSystemObject,
etc to get the File and rename it. Simpler if you use the simple name
in the DTS package and THEN rename it, so the package doesn't need to
change. If you expect to get more than one file per day, like I did,
you can append from .GetTempName to keep it unique.

--
AddThis Social Bookmark Button