Results 1 to 10 of 10
  1. #1
    Join Date
    Sep 2004
    Posts
    5

    Unanswered: Exporting Multiple tables to a single file

    I need to export data from multiple tables into one single file. The big problem here is that the tables will have different column types.

    I am attempting to create something that allows users to be able to send me the contents of their tables's, through either email or ftp. I would prefer to make it easier for them so they only have to deal with one file, instead of the multiple files that bcp and dts create when exporting from multiple tables.

    I was thinking of using DTS or BCP and then join (append) the files (either zip them or append the files together in some fashion), but I was hoping that there was an easier method out there.

    Any ideas on how I may accomplish this would be greatly appreciated.

    Andy

  2. #2
    Join Date
    Feb 2004
    Posts
    492
    Why not create a table that matches the final datatype/s, do an insert from all the tables that need to be exported and then dump the table to a file? At the end, drop the table or truncate it. Varchar datatype usually does wel in storing most datatypes.

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

    1 Build a scratch directory,
    2 Create the needed files in the scratch directory
    3 Zip the entire scratch directory
    4 Email the zip file
    5 Delete the files and scratch directory
    6 Delete the zip file if it wasn't needed any more

    -PatP

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Quote Originally Posted by andyhuck
    I am attempting to create something that allows users to be able to send me the contents of their tables

    WAIT: Fundamental flaw in process!

    I'd have a sproc perform a backup and then send the backup file (after it was zipped).
    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.

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Quote Originally Posted by Brett Kaiser
    WAIT: Fundamental flaw in process!

    I'd have a sproc perform a backup and then send the backup file (after it was zipped).
    If what needed to be sent was over 50% of the database, then I'd agree with Brett. If you only want 50 Kb of a 30 Gb database and the users connect via dial up, I like my plan better. I guess a lot depends on the circumstances.

    -PatP

  6. #6
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    "It Depends"

    My favorite answer....
    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.

  7. #7
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Quote Originally Posted by Brett Kaiser
    "It Depends"

    My favorite answer....
    Darned if I don't like that one too!

    -PatP

  8. #8
    Join Date
    Sep 2004
    Posts
    5
    I think I forgot to mention one detail that might complicate things. I'm planning on doing some sort of web based .net application with C#. Is it difficult to use DTS through an application like this?

    I know how to do sql queries in .net but is there some way to use DTS in this type of app?

  9. #9
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    There are actually many ways to use a DTS package from c#.

    -PatP

  10. #10
    Join Date
    Sep 2004
    Posts
    5
    And how about BCP in this situation?

Posting Permissions

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