Posts

Showing posts from December, 2018

T-Sql Script for Automating Replication Generation for all Stored Procedures in a SQL Server Database

Image
This involves following steps: Creating stored procedure named Create_Replication_SP using the code provided in this post. Please find the T-sql script below that can be used to create,configure and run replication for all stored procedures in a database automatically.  Once stored procedure is in place all you have to do is provide the name of the database as the parameter as shown in example below: Use NameOfDatabasewhereSpIsCreated GO EXEC [Create_Replication_SP] @Database_Name='NameOfDatabaseHere' This will generate and Print a script in return in messages tab in SSMS.  Copy the generated script and paste it in new query window and execute it and wait for its completion, progress gets tracked in Messages tab in Output window.  What script does: This creates Publication with nomenclature DatabaseName_SP or if you want a custom name you can pass the parameter @Publication_Name along with @DatabaseName (should be under 20 characters).  Creates a snapshot agent