• From what I understand of your question, a simple UNION ALL will get you what you need. The example answer assumes that both databases are in the same server. If not, you'll need to create a linked server.

    use AgencyBackupDB

    go

    -- All HazineGroup rows from both databases

    select HazineGroupID, HazineName from dbo.HazineGroup

    union all

    select HazineGroupID, HazineName from AgencyDB.dbo.HazineGroup

    where HazineGroupID not in (select HazineGroupID from dbo.HazineGroup)

    -- All Hazine rows from both databases

    select HazineID, HazineGroupID, Mablagh, HazineName from dbo.Hazine

    union all

    select HazineID, HazineGroupID, Mablagh, HazineName from AgencyDB.dbo.Hazine

    where HazineID not in (select HazineID from dbo.Hazine)

    -- All SabtHazine rows + any SabtHazine rows in AgencyDB

    select SabtHazine_ID, HazineID, EndUserNAme, Tedad, sabtHazineDate, Describtion from dbo.SabtHazine

    union all

    select SabtHazine_ID, HazineID, EndUserNAme, Tedad, sabtHazineDate, Describtion from AgencyDB.dbo.SabtHazine

    where SabtHazineID not in (select SabtHazineID from dbo.SabtHazine)

    The WHERE conditions are probably unnecessary. But just trying to interpret the requirements at face value.