• Hello ,

    In order to see if the tables aren't identical you don't have to make so sophisticated script.

    My suggestion to you is like this :

    declare @data table( Table1 nvarchar(max), Table2 nvarchar(max) )

    insert into @data

    (Table1,Table2)

    select

    (select * from

    db1.dbo.GalleryCategories as tbl

    for xml auto

    ) as Table1,

    (select * from

    db2.dbo.GalleryCategories as tbl

    for xml auto

    ) as Table2

    SELECT CASE

    WHEN count(TablesDataCompare.Table1)>0 THEN 'Yes'

    ELSE 'No'

    END

    [Is Identical Tables?]

    FROM

    (SELECT Table1,Table2

    FROM @data

    WHERE Table1=Table2

    ) TablesDataCompare

    When running the script you will see if the tables data are identical or not identical

    Good luck.

    Michael

    🙂