Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Compare table data on two different databases

Compare table data on two different databases

Scheduled Pinned Locked Moved Database
question
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vanikanc
    wrote on last edited by
    #1

    Hi! Is there a way to compare data of the same table in two different databases? Thanks!

    C C L 4 Replies Last reply
    0
    • V vanikanc

      Hi! Is there a way to compare data of the same table in two different databases? Thanks!

      C Offline
      C Offline
      Chris Meech
      wrote on last edited by
      #2

      Export to text files and use a difference tool on the files. Just one suggestion. :)

      Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

      C 1 Reply Last reply
      0
      • C Chris Meech

        Export to text files and use a difference tool on the files. Just one suggestion. :)

        Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

        C Offline
        C Offline
        Corporal Agarn
        wrote on last edited by
        #3

        You can do it that way but shame on you! :laugh:

        C 1 Reply Last reply
        0
        • V vanikanc

          Hi! Is there a way to compare data of the same table in two different databases? Thanks!

          C Offline
          C Offline
          Corporal Agarn
          wrote on last edited by
          #4

          What database server are you using?

          V 1 Reply Last reply
          0
          • C Corporal Agarn

            You can do it that way but shame on you! :laugh:

            C Offline
            C Offline
            Chris Meech
            wrote on last edited by
            #5

            Actually it's not the only way I do it, but I have found it a useful way when 'migrating' an application from one physical DB to another. I usually automate it so that I have only to review a log report of any differences that are actually discovered. But considering that there are many reasons for comparing the data, until you know all the requiremens, sometimes the simple solutions work best. :)

            Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

            1 Reply Last reply
            0
            • C Corporal Agarn

              What database server are you using?

              V Offline
              V Offline
              vanikanc
              wrote on last edited by
              #6

              sql server 2005.

              1 Reply Last reply
              0
              • V vanikanc

                Hi! Is there a way to compare data of the same table in two different databases? Thanks!

                C Offline
                C Offline
                Corporal Agarn
                wrote on last edited by
                #7

                Example of finding records in D1 that are not in D2

                SELECT D1.[DepartmentID]
                ,D1.[Name]
                ,D1.[GroupName]
                ,D1.[ModifiedDate]
                FROM [AdventureWorks].[HumanResources].[Department] D1
                LEFT JOIN [AdventureWorks2008R2].[HumanResources].[Department] D2
                ON D1.DepartmentID = D2.DepartmentID
                WHERE D2.DepartmentID IS NULL

                Notice how the table is referenced by Database.Schema.Table. Use the where clause to compare individual columns.

                1 Reply Last reply
                0
                • V vanikanc

                  Hi! Is there a way to compare data of the same table in two different databases? Thanks!

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  vanikanc wrote:

                  Is there a way to compare data of the same table in two different databases?

                  Yes! Multiple! What have you Googled? On a more serious note, RedGate has a nice tool that could help out.

                  vanikanc wrote:

                  Thanks!

                  You're welcome :)

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups