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 two tables in different environments.

compare two tables in different environments.

Scheduled Pinned Locked Moved Database
questiondatabasesql-serversysadminhelp
8 Posts 5 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

    Hello, Is there some tool in sql server which would help me compare two tables and tell me what is different in it? Thanks!

    W M D O 4 Replies Last reply
    0
    • V vanikanc

      Hello, Is there some tool in sql server which would help me compare two tables and tell me what is different in it? Thanks!

      W Offline
      W Offline
      Wendelius
      wrote on last edited by
      #2

      Do you want to compare the contents of the tables. If that's the case I think the quickest way could be to use EXCEPT[^]. If the table structure is the same, you could do comparison like:

      SELECT * FROM FirstTable
      EXCEPT
      SELECT * FROM SecondTable

      and then other way round:

      SELECT * FROM SecondTable
      EXCEPT
      SELECT * FROM FirstTable

      If there are structural differences, specify the columns you want to compare.

      The need to optimize rises from a bad design.My articles[^]

      1 Reply Last reply
      0
      • V vanikanc

        Hello, Is there some tool in sql server which would help me compare two tables and tell me what is different in it? Thanks!

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        Are you talking about comparing the structure or the data? They require 2 different strategies. Do you want to do this for 1 pair of table or are you looking to compare an entire database? They require 2 different strategies. If you need to compare databases then look at Red-Gate sql and data compare tools.

        Never underestimate the power of human stupidity RAH

        V 1 Reply Last reply
        0
        • M Mycroft Holmes

          Are you talking about comparing the structure or the data? They require 2 different strategies. Do you want to do this for 1 pair of table or are you looking to compare an entire database? They require 2 different strategies. If you need to compare databases then look at Red-Gate sql and data compare tools.

          Never underestimate the power of human stupidity RAH

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

          To be more clear, I would like compare the data with in two tables of same design. Would like to report all rows that are different.

          V 1 Reply Last reply
          0
          • V vanikanc

            To be more clear, I would like compare the data with in two tables of same design. Would like to report all rows that are different.

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

            Thanks so much, EXCEPT really works, and it is really fast as well.

            W 1 Reply Last reply
            0
            • V vanikanc

              Thanks so much, EXCEPT really works, and it is really fast as well.

              W Offline
              W Offline
              Wendelius
              wrote on last edited by
              #6

              Since you mentioned the EXCEPT solution, consider voting the post (http://www.codeproject.com/Messages/3802207/Re-compare-two-tables-in-different-environments.aspx[^]) good or bad depending how you feel the answer helped you.

              The need to optimize rises from a bad design.My articles[^]

              1 Reply Last reply
              0
              • V vanikanc

                Hello, Is there some tool in sql server which would help me compare two tables and tell me what is different in it? Thanks!

                D Offline
                D Offline
                dingoishere
                wrote on last edited by
                #7

                Try D-Softs Database Compare d-softs.com

                1 Reply Last reply
                0
                • V vanikanc

                  Hello, Is there some tool in sql server which would help me compare two tables and tell me what is different in it? Thanks!

                  O Offline
                  O Offline
                  Om Prakash Pant
                  wrote on last edited by
                  #8

                  Please check the following link which might help you: http://www.sqlteam.com/article/comparing-tables[^]

                  Om Prakash Pant

                  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