SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Getting the name of a file in a location when the file name changes using DTS


Getting the name of a file in a location when the file name changes using DTS

Author
Message
GF
GF
Mr or Mrs. 500
Mr or Mrs. 500 (566 reputation)Mr or Mrs. 500 (566 reputation)Mr or Mrs. 500 (566 reputation)Mr or Mrs. 500 (566 reputation)Mr or Mrs. 500 (566 reputation)Mr or Mrs. 500 (566 reputation)Mr or Mrs. 500 (566 reputation)Mr or Mrs. 500 (566 reputation)

Group: General Forum Members
Points: 566 Visits: 985
To all,

Using SQL 2000 DTS.

I have an Excel connection named "FileToProcess".
I have a global variable named "gvSourceFilePath" and I have assigned something like this to the Global Variable,
"Drive Letter:\FolderName\"

Any number of files will be dropped off in the location defined by the global variable
and they will be named in this format ?????XXXX.xls
????? means I have no idea what this part of the file name will be.
XXXX is a 4 digit number that looks something like this 4700 or 2600 or 3300, there will be 33 variations of this number and the file extension is .xls

I am trying to use Active X to accomplish this task.

This is the rest of my process so you will have the big picture.
Once I get the name of the file, if it is something like ???4700.xls I want to process it by extracting certain columns to text file1 and certain columns to text file2.

I then need to move the resulting text files to a location specific to the file name such as 4700, or 2600, or 3100 files. Again, there are 33 variations for the file names so there will be 33 different destinations.


Here is what I have as of this time.
Function Main()


Dim oConn, sFilename

' Filename format - eXXXX.xls


sFilename = DTSGlobalVariables("gvSourceFilePath").Value & _
sFilename & ".xls"
msgbox sFilename
Set oConn = DTSGlobalVariables.Parent.Connections("FileToProcess")
oConn.DataSource = sFilename

Set oConn = Nothing

Main = DTSTaskExecResult_Success


End Function


I would really appreciate it if someone could help me finish this off.
I have beating my head against a wall and I am running out of time.

Thanks to all

Gary



AVB
AVB
SSC Eights!
SSC Eights! (924 reputation)SSC Eights! (924 reputation)SSC Eights! (924 reputation)SSC Eights! (924 reputation)SSC Eights! (924 reputation)SSC Eights! (924 reputation)SSC Eights! (924 reputation)SSC Eights! (924 reputation)

Group: General Forum Members
Points: 924 Visits: 820
Gary,

Do you have to use Active X?

I've written packages where I'll list all the files in a particular directory and then process them one at a time. I do this all from an SP that runs the import package. I manually run the SP so I haven't needed to put it in a DTS package/Job yet.

Step 1 - List all files in directory and insert them into a log table.
Step 2 - Then I read each file path name and process each file by executing the dtsrun command.
Step 3- Move files to appropriate archive directory

Okay just realized your post was almost a year old... Nvm.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search