On Oct 6, 3:41 pm, jefftyzzer wrote:
> On Oct 3, 9:56 am, raja wrote:
>
> > Hi,
>
> > I have 2 tables.
> > I have to compare whether the data in those 2 tables are same or not.
> > ( For example : I have to find, how many records different between
> > those 2 tables, if those tables are almost similar)
>
> > How can i find this ?
>
> > With Regards,
> > Raja
>
> Hi, Raja
>
> Does (your version of) Sybase support the DIFFERENCE operation (maybe
> called MINUS or EXCEPT)? If not, you could do something as ungainly as
> export the data to files and compare them using, e.g., diff or CSDiff,
> assuming the row count's not prohibitive.
>
> --Jeff
Raja:
Just to help expedite your efforts lest I keep you in suspense,
assuming that Sybase does have DIFFERENCE/MINUS/EXCEPT functionality,
the general pattern for comparing table contents using that method is:
SELECT
COUNT (*)
FROM
(
(
SELECT
*
FROM
table1
MINUS
SELECT
*
FROM
table2
)
UNION
(
SELECT
*
FROM
table2
MINUS
SELECT
*
FROM
table1
)
) X;
--Jeff
>> Stay informed about: Comparison of 2 Tables