Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2004
    Posts
    15

    Smile Unanswered: Exporting to excel

    Hi,

    I have VB 6.0 application which accepts two database tables and compares the data in those tables.(Compares col. by Col.). Then it emphasises the changes with different colors i.e Modification - Yellow ,Addition - Red ,- Deletion Blue etc.

    I have given one option to export the data to MS - Excel. The out put required to the Excel File is One record from Source table and Second one from Destination file / table (So that it would be easy to understand the comparison between two records).I have one column common to both the tables.Using this column i compare the records and emboss with color codes.

    But when i export to Excel i select first ID (which is common)
    export the record from source file then get record with the same id from desitination file and export that to the next line. But for say, 10000 records it takes a lot of time.
    Do anyone have the solution?

    Thanks & regards
    Rohit

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    This sounds like a poster child problem for a FULL OUTER JOIN to me.

    -PatP

  3. #3
    Join Date
    Sep 2004
    Posts
    15
    Not Exactly! bacause I am exporting only the rows which are matching from both the tables.

    Now i want to export to the excel
    e.g.
    Row1 - Headings
    Row2 - Record from Table1
    Row3 - Record from Table2 with same ID
    Row4 - Next Record from Table1
    Row5 - Record from Table2 ....

    If I go one by one, definitely it is going to take chunk of time!
    Don't know whether there is any altrnative available for this!

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    What you really want is a FULL OUTER JOIN. Let the VB app handle creating the spreadsheet from the result set (making two rows in the app's output from one row of the query's output) and let the SQL Server do the "heavy lifting" of the data for you.

    There is a disconnect between your query and your desired output, but the client side code in the VB app can handle that disconnect nicely!

    -PatP

Posting Permissions

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