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

Sign In or Register to comment.