O'Reilly logo

Microsoft SQL Server 2008 High Availability by Hemantgiri S. Goswami

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

Installing publication and subscription using T-SQL

We have learned how to install publication using SQL Server Management Studio. Let's now see how to install Transactional Replication using T-SQL. The following code will enable the database for the publication. We have to specify the name of the database and a value as true.

use [SSCitationSR]
exec sp_replicationdboption
@dbname = N'SSCitationSR',
@optname = N'publish',
@value = N'true'
GO

The following code will create the reader agent that will read the transactions to be published:

use [SSCitationSR]
exec [SSCitationSR].sys.sp_addqreader_agent
@job_login = null,
@job_password = null,
@job_name = null, @frompublisher = 1
GO

The following code will create publication for the given database: ...

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