Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
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: 1567 | Views in the last 30 days: 5
 
Related Articles
SCRIPT

Synchronize several stored procedure between two servers

Synchronize source code between two servers for multiple stored procedures

SCRIPT

Synchronize all stored procedures between two servers

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

FORUM

create Procedure within Procedure

create Procedure within Procedure

FORUM

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

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

FORUM

Executing stored procedures on Linked Servers

Stored Procedures between DBs

Tags
linked server    
stored procedures    
t-sql    
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones