SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Synchronize a stored procedure between two servers

By Th Tr,

Sometimes I need to synchonize source codes between development and production server. So, I created this stored procedure to help me do that instead of generating scripts from one server and execute it in another server.

To run this stored procedure, you need to create two linked servers for your source server and your target server. You can create them in local SQL Server and then run this to synchronize.

For example, your development server is called DEV and your production server is called PROD, and you create two linked servers in local SQL Server with the same name. Assumed that your database between DEV and PROD have the same name: TestDB.

If you want to synchronize TestProc stored procedure between TestDB of DEV and PROD, you can excute like that:

EXEC @ProcedureName = 'TestProc', @SourceServer = 'DEV', @SourceDatabase = 'TestDB', @TargetServer = 'PROD', @TargetDatabase = 'TestDB'

Total article views: 1625 | Views in the last 30 days: 2
Related Articles

Synchronize several stored procedure between two servers

Synchronize source code between two servers for multiple stored procedures


Synchronize all stored procedures between two servers

This script will synchronize all stored procedures between two servers, using spSynchStoredProcedure...


create Procedure within Procedure

create Procedure within Procedure


Difference between Create User and Create Login .....♀§♀§♀§

Difference between Create User and Create Login .....♀§♀§♀§


Executing stored procedures on Linked Servers

Stored Procedures between DBs

linked server    
stored procedures