Click here to monitor SSC
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 view 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.

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

EXEC dbo.spSynchView @ViewName = 'TestView', @SourceServer = 'DEV', @SourceDatabase = 'TestDB', @TargetServer = 'PROD', @TargetDatabase = 'TestDB'

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

Total article views: 556 | Views in the last 30 days: 2
 
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

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

FORUM

Creating Linked Servers Using Windows Authentication

Creating Linked Servers Using Windows Authentication

Tags
t-sql    
 
Contribute