Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2004
    Posts
    30

    Unanswered: BULK INSERT maybe ???

    I have a directory with files:

    X.dbf
    X.mdx
    Y.dbf
    Y.mdx
    ...

    These files contain updates for my DB (I don't know their structure). How I can insert them in temporary tables on the SQL server ?

    Note: I don't want to use Import/Export Tool, cause I will need this insert as scripts...
    Last edited by The-Saint; 10-05-04 at 09:02.

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I'd use DTS.

    -PatP

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Quote Originally Posted by Pat Phelan
    I'd use DTS.

    -PatP
    You would?

    I'd create a sproc....


    USing xp-Cmdshell, I would interogate the directory and load the file names to a table.

    I would process the files 1 by 1

    I would the bcp the data in to a single column varchar table

    I would then process the data.

    Bu if you don't know the structure of the data, what would you propose you'd do?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    Jan 2004
    Location
    In a large office with bad lighting
    Posts
    1,040
    Last time I did something like this, the .dbf extension files came from dBase V. DTS has an interface for that datafile type. As for .mdx ... ???

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    It isn't hard to determine the schema of a DBF file, as Tom pointed out they are just dBase files which are effectively a single table with the schema tucked into the file header. You can relatively easily import arbitrary dbf files into a database from within a DTS package... It is more complex than dealing with a static structure, but not rocket science by any means.

    The MDX files are just queries written as Multi-dimensional Expressions. Those can simply be stuffed into a TEXT column somewhere, probably the best organization would be to simply track what file they came from (X.MDX) and the text in a single table, maybe with some decorative columns to track when the file was timestamped, when it was imported into the table, etc.

    -PatP

  6. #6
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    Multi-dimensional Expressions? I may be way off, but I think I remember MDX to be primary indexes and NDX secondary (???)...Or maybe it's FoxPro? It's been awhile.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  7. #7
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    I should just make it part of my sig...


    "It really helps if you read these things"
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  8. #8
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    ...and your point is...???
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •