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 function between two servers

By Th Tr,

This script is the same method with spSynchStoredProcedure but used for views.

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.

This procedure may be useful if your function is not over 4000 characters. If it's over 4000 characters, you have to modify it a little.

If you want to synchronize a function called TestFunc between TestDB of DEV and PROD, you can excute like that:

EXEC dbo.spSynchFunction @FunctionName = 'TestFunc', @SourceServer = 'DEV', @SourceDatabase = 'TestDB', @TargetServer = 'PROD', @TargetDatabase = 'TestDB'

 

Total article views: 556 | Views in the last 30 days: 1
 
Related Articles
FORUM

The concurrent snapshot for publication 'TESTDB' is not available

The concurrent snapshot for publication 'TESTDB' is not available because it has not been fully gene...

FORUM

Create server side trace.

Cannot create server side trace - error 12

FORUM

To create login in many servers.

To create login in many servers.

FORUM

Creating SQL Server 2000 Virtual Directories

Creating IIS SQL Server 2000 Virtual Directories

FORUM

error when creating the link server

error when creating the link server

Tags
t-sql    
udf    
 
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