简体   繁体   中英

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

There are two stored procedures which has same name and same logic. But in different databases. Only some of the content names are different (example - Synonym Name, Table Name, schema). Other code is the same.

Is there any way to compare code between above two stored procedures?

Personally i prefer to use a 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 (in full) or a database with the SSDT project schema. It will show you the differences and allow you to publish those differences.

Configurable and powerful.

I highly recommend it.

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

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

You can download the 30 days free trial version also.

For many type of comparisons (folder, text, etc.) you can use Beyond Compare (they offers 30 days trial, but after it, you can simple reinstall it).

在此输入图像描述

If you want something free, you can use a compare plugin for NotePad++ but is not so fancy as the first tool:

在此输入图像描述

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

Even though the source code for stored procedures can readily be retrieved from the database, they should really reside in a VCS for any database that is (or will be) productionised.

Historically, this has been something of a manual process but later versions of Visual Studio include the SQL Server Database Project type which makes development and deployment much easier.

The question then becomes the far easier one of how to compare files within the VCS which is typically trivial as this sort of thing is generally provided out of the box.

Aquastudio做得很好。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM