Results 1 to 2 of 2

Thread: Comparision Of Two Tables Data

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2009
    Posts
    1

    Comparision Of Two Tables Data

    Hi Friends,
    I am struggling with issues related to data comparison from two tables.
    Let me give you some description of my task and the problem

    Task:
    Table A has columns X,Y,Z & Table B has Columns X1,Y1,Z1 and data type are exactly same.
    I am taking each record into a recordset, say rs1(record of Table 1) & rs2(record of Table 2)
    I am comparing first two values of two tables and if they are matching then i amcomparing the remaining values in the matched row.

    I succeeded in doing the above activity for integers(numbers) but subsequently i am not able to compare the values with CHAR or VARCHAR type.

    I tried all possibilities i know like strcmp, typecasting,.....

    Please let me know if there are other alternatives to achive my goal.

    Attached doc contains code i wrote. This may be a wiered VB code as this is my first VB script. So please let me know if further information required.

    Thanks a tonn in Advance

    Regards,
    Saif
    Attached Files Attached Files

  2. #2
    Hyperactive Member
    Join Date
    May 2006
    Posts
    365

    Re: Comparision Of Two Tables Data

    Dear Saeed,

    Why are you comparing the two tables? What is the objective?

    If all you are trying to achieve is find all records from table 1 that exist in table 2 then SQL may be your best alternative.

    SELECT * FROM tbl1
    INTERSECT
    SELECT * FROM tbl2



    If you want only the records that are different between the tables

    SELECT * FROM tbl1
    EXCEPT
    SELECT * FROM tbl2


    Kind regards

    Steve

Posting Permissions

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



Click Here to Expand Forum to Full Width