Getting Started with Web applications development with servlets and JSP - Part 5: Filters
First Time? You can support us by signing up. It takes only 5 seconds. Click here to sign up. If you already have an account, click here to login.


Upload Image Close it
Select File

Learned something today? Share it, or learn from what others have learned today

Script to add views in existing publication in transactional replication - SQL Server

Oct 3 2011 7:56AM by Paresh Prajapati   

As last time i submitted script to add table in existing publication here http://beyondrelational.com/justlearned/posts/692/script-to-add-table-in-existing-publication-in-replication-sql-server.aspx, you can find the script to add views in existing publication.

USE PublisherDB
GO

exec sp_addarticle 
@publication = N'PublicationName', 
@article = N'ViewName', 
@source_owner = N'schemaName', 
@source_object = N'ViewName', 
@type = N'view schema only', 
@description = N'', 
@creation_script = N'', 
@pre_creation_cmd = N'drop', 
@schema_option = 0x0000000008000001, 
@destination_table = N'ViewName', 
@destination_owner = N'schemaName', 
@status = 16
GO

Hope you liked this.

Read More..  [0 clicks]


Paresh Prajapati
7 · 24% · 5511
4
 
1
 
 
0
Incorrect
 
0
Interesting
 
0
Forgotten
 
0
Move



Submit

2  Comments  

  • While this particular system stored procedure is known to almost anyone who has worked with replication in SQL Server, I must say that this is especially useful when one needs to maintain the replication link when upgrading the underlying schema with a new article that needs replication.

    Thanks for sharing, Paresh!

    commented on Oct 3 2011 10:04AM  .  Report Abuse This post is not formatted correctly
    Nakul Vachhrajani
    6 · 26% · 5926
  • I knew about this SP but never used it before, I might give it a shot.

    commented on Oct 4 2011 12:43AM  .  Report Abuse This post is not formatted correctly
    Szymon Wojcik
    60 · 4% · 788

Your Comment


Sign Up or Login to post a comment.

"Script to add views in existing publication in transactional replication - SQL Server" rated 5 out of 5 by 4 readers
Script to add views in existing publication in transactional replication - SQL Server , 5.0 out of 5 based on 4 ratings
    Copyright © Beyondrelational.com Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising