Import dBASE variable filenames?

  • So, how I can get this code to work with a wildcarded filename?:

    SELECT *

    INTO Project01tmp

    FROM OpenRowSet{'MSDASQL', 'Driver=(Microsoft dBASE Driver (*.dbf(};DriverID=277;DBQ=C:\ProjectDir', 'select * from Proj01'); <-- Proj01 need to be wildcard *.dbf
    INSERT INTO Project01tmp
    (FirstName, LastName, ....)

    I'm having to specify the filename currently. How do I wildcard it correctly to import ANY dbf file instead of only Proj01.dbf? The client has no problem only putting one file at a time in the directory, it's just that the names will vary all the time.
    So, is there a way to make it work as *.dbf?
    Thanks.

  • This was removed by the editor as SPAM

  • I have already posted a reply but as often happens with this forum it just dissapeared

    So here goes again...

    I had a similar situation but needed control of what was happening and when. I needed to know what file was processed and from where it came etc. The system I had accounted for vast sums from counting machines, so if this may be overkill.

    I also needed tp process many files from many sources and controlled everything from the vb application.

    Steps:

    1. Files arrive in directory
    2. VB checks the directory
    3. archives the file to a new directory with additional data in the file name
    4. Copies the file to the processing directory (Always with the same name (The one in the stored proedure))
    5. Deletes the original file
    6. Calls the procedure
    7. deletes the file from the processing Directory

    Note that when calling the stord precedure I would execute the script withy a varchar parameter that passed the file name (Archived name above). That filename was inserted into the header for the imported data so that a full audit trail could be followed.

    This procedure managed thousands of files a day.

    Hope that helps

  • Isn't there a tsql option to make this possible though? This is a totally server side run setup. No VB programming, only sp's and DTS, etc.

    Or is it impossible with just sql code on ms sql server 2000 to handle variable filenames?

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply