Best approach to compare SQL Server database scripts.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gene94043
    New User
    • Jan 2010
    • 2

    Best approach to compare SQL Server database scripts.

    I am new to BC. I have two database creation scripts of almost the same database, one script generated from SQL 2000 and one from SQL 2005. The scripts include creates of stored procedures, tables, and views. The stored procedure, table, and view names are the same in each of the files. I need to find all the differences, such as differences in statement parameter values, which I am sure are minor. The problem is that the order of the creates in each script differ significantly. Sorting the files by individual lines is probably not an option, as everything gets mixed up. Is there a way to sort blocks of statements, ie, sort entire create statement blocks by object name? Or, is there another preferred way to approach this problem? TIA.
  • Michael Bulgrien
    Carpal Tunnel
    • Oct 2007
    • 1772

    #2
    Nothing built in to BC (or any other text compare tool I know, for that matter). You could generate the scripts into individual files for each database object instead of into a single concatinated script. This would allow you to perform a folder compare on all the scripted database objects. From the folder compare, you could then open aligned file pairs to see text comparisons of the like objects in each database.
    BC v4.0.7 build 19761
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

    Comment

    • Michael Bulgrien
      Carpal Tunnel
      • Oct 2007
      • 1772

      #3
      For that matter, it wouldn't be that hard to write a vbScript to parse the two large scripts into separate files for each created object.
      BC v4.0.7 build 19761
      ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

      Comment

      • Aaron
        Team Scooter
        • Oct 2007
        • 16017

        #4
        Unfortunately, Beyond Compare does not have a built-in method for sorting on blocks of code. If you are familiar with any command line application that is capable of sorting the files, then you can use that application automatically within Beyond Compare whenever a specific pair of files is opened.

        Examples of this for HTML Tidied and Java Tidied can be found here:
        http://www.scootersoftware.com/downl...kb_moreformats

        We have details on how to set that up here:
        http://www.scootersoftware.com/suppo...rnalconversion
        Aaron P Scooter Software

        Comment

        • gene94043
          New User
          • Jan 2010
          • 2

          #5
          Thank you for your replies.

          Generating an individual file for each db object, then doing a folder compare with BC, sounds like a good approach.

          Comment

          Working...