Quickly compare two objects

Hi - is there a way to quickly compare two objects.  I can do this very nicely with SQL Source control but a lot of our legacy stuff we've inherited isnt in source control at the moment.  management always say the same thing, "it won't be here in a couple of months so not worth the effort..." and then 2 years pass and they still say the same thing.

The use cases I would see

1.  I want to quickly compare dbo.usp_SomeStoredProc on dev with the one in production.

2.  I am testing on the same environment and am doing regression testing on two procs.  dbo.usp_StoredProc_New and dbo.usp_StoredProc_current.  They are producing different results and I want to refine the newer one whilst having the production one as a baseline.

I've created the user voice below - just wondering if anyone had any advice.

at the moment i have to export and use winmerge on the 2 different files.

https://redgate.uservoice.com/forums/141379-sql-compare/suggestions/37299100-ssms-integration-compare-single-object

p.s.  the stuff we do have in source control we are using Visual Studio database projects and we still gets tonnes of drift so the above would still be nice features to have.

Best Answer

  • Sergio RSergio R Posts: 610 Rose Gold 5
    Hi Ben,

    1.  I want to quickly compare dbo.usp_SomeStoredProc on dev with the one in production.

    If the issue here is that dev and prod are in different environments in which you can't do a comparison directly because of network restrictions, then the best option would be to capture a snapshot from one of the sources and use that. You can do this using SQL Compare, but if for some reason you don't or don't want to have SQL Compare installed where you can access the database you want to snapshot, you can create this it using SQL Snapper: https://www.red-gate.com/simple-talk/blogs/compare-those-hard-to-reach-servers-with-sql-snapper/

    You can use the command line to create snapshots both when using SQL Snapper and SQL Compare Pro.

    You can then also use SQL Compare Pro command line to carry out the actual comparison.

    The comparison itself will not be quicker, but by using the command line you can have a script ready to use when you need to do this and just adjust the type and name of the object you want to compare (using the /include switch)

    2.  I am testing on the same environment and am doing regression testing on two procs.  dbo.usp_StoredProc_New and dbo.usp_StoredProc_current.  They are producing different results and I want to refine the newer one whilst having the production one as a baseline.

    Regarding your second example, I can't see an alternative to checking out the previous version of the database scripts folder and using that as a source. Using the command line as described above might make the process more efficient.
    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools

Answers

  • ben_bben_b Posts: 84 Silver 2
    thanks very much for taking the time to answer.  I will definitely check out the command line and get back to you.

  • ben_bben_b Posts: 84 Silver 2
    hi @Sergio R - I did spend some time with the command line using the include switch and made some progress but it was a struggle and wasnt "ingeniously simple"...

    I've created a very bad screen mock-up of what I was thinking to see if anyone else sees value in what i'm talking about.  its based on the comparison pane inside SQL Source Control...  its basically being able to run something like K-Diff or WinMerge from within SSMS.

    cheers
    Ben


Sign In or Register to comment.