O'Reilly logo

Microsoft® SQL Server™ 2005 Administrator's Companion by Victor Isakov, Stacia Misner, Burzin Patel, Marcilina Garcia, Edward Whalen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a Publication with SQL Statements

The following is an example that shows the creation of the publication shown above using SQL statements, rather than the wizard.

The following stored procedures are used:

  • sp_replicationdboption sets database options for replication.

  • sp_addpublication creates and configures the publication.

  • sp_addpublication_shapshot creates the snapshot agent.

  • sp_addarticle will add the various articles to the publication.

The example is shown here:

use [AdventureWorks] exec sp_replicationdboption @dbname = N'AdventureWorks', @optname = N'publish', @value = N'true' GO use [AdventureWorks] exec sp_addpublication @publication = N'AWPub', @description = N'Transactional publication of database' 'AdventureWorks' 'from Publisher' ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required