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. Table comparison

Table comparison

Scheduled Pinned Locked Moved Database
databasesql-serversysadminregexquestion
3 Posts 3 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

    I need to compare two tables in sql server. they are located on different databases. I need to compare the data. The tables have about 200 fields in them. IS there a way to compare this data and know which field does not match? Using a hashtotal, would say if two rows are different but does not which data is exactly different. And it gets tough with 200 fields in a table. Also the size of the table is big, about 100000 rows at minimum. Thank you so much.

    L D 2 Replies Last reply
    0
    • V vanikanc

      I need to compare two tables in sql server. they are located on different databases. I need to compare the data. The tables have about 200 fields in them. IS there a way to compare this data and know which field does not match? Using a hashtotal, would say if two rows are different but does not which data is exactly different. And it gets tough with 200 fields in a table. Also the size of the table is big, about 100000 rows at minimum. Thank you so much.

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

      I suggest you create a copy of the second table in the first server - otherwise your compare will be delayed by the network.

      vanikanc wrote:

      Using a hashtotal, would say if two rows are different but does not which data is exactly different. And it gets tough with 200 fields in a table.

      200 fields? How about normalizing that table? You could write a small table-valued function that compares each field individually for a given record and that spits out only the columnnames where there's differences, by looping through all the columns (see sys.columns). Another option might be Sql Compare[^] from Red Gate. It shows the difference in your data, but also on a row-by-row level. The changed columns are highlighted in a different color though, and there's a trial-version available.

      Bastard Programmer from Hell :suss:

      1 Reply Last reply
      0
      • V vanikanc

        I need to compare two tables in sql server. they are located on different databases. I need to compare the data. The tables have about 200 fields in them. IS there a way to compare this data and know which field does not match? Using a hashtotal, would say if two rows are different but does not which data is exactly different. And it gets tough with 200 fields in a table. Also the size of the table is big, about 100000 rows at minimum. Thank you so much.

        D Offline
        D Offline
        David Mujica
        wrote on last edited by
        #3

        How about using the Hashtotal or checksum concept and if the two rows are different, then write them out to 2 different text files (FileA & FileB). At the end of the process, you could use a tool like BeyondCompare to compare the data in the two files. Just a thought. Awesome tool to have in your bag of tricks ... http://www.scootersoftware.com/[^]

        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