Compare code between two stored procedures in two different databases in SQL Server

There are two stored procedures that have the same name and the same logic. But in different databases. Only some of the content names are different (example - synonym name, table name, schema). The other code is the same.

Is there a way to compare the code between two stored procedures?

+3


source to share


5 answers


For many types of comparisons (folder, text, etc.), you can use Beyond Compare (they offer a 30-day trial, but after that, you can just reinstall it).

enter image description here

If you want something free, you can use the comparison plugin for NotePad++

, but not as fantastic as the first tool:



enter image description here

Plugin Manager

can be opened from Plugins -> Plugin Manager -> Show Plugin Manager

.

+1


source


Personally, I prefer to use the SSDT project (SQL Server Data Tools)

It allows you to store the entire database schema in a Visual Studio project and in git / svn.

It is capable of comparing two databases (completely) or a database against the SSDT project schema. It will show you the differences and let you post those differences.



Customizable and powerful.

I highly recommend it.

+4


source


I am using the "Araxis Merge" file comparison tool to compare files in my project.

Please check the link to download the tool - http://www.araxis.com/merge/index.en

You can also download a 30-day free trial.

+1


source


Although the source code for the stored procedures can be easily retrieved from the database, they must actually be in the VCS for any database that is (or will be) created.

Historically, this was a bit of a manual process, but later versions of Visual Studio include a SQL Server database project type that makes development and deployment much easier.

Now the question becomes much easier to compare files in VCS, which are usually trivial since such things are usually provided out of the box.

+1


source


Aquastudio does this pretty well.

-1


source







All Articles