|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-12-02 : 12:34:18
|
| Create replication manually for a couple of tables/views as you have been. Then script it out by going to the publication and generating the script. Then you'll see the code necessary to create replication. Here is an example:-- Enabling the replication databaseuse masterGOexec sp_replicationdboption @dbname = N'GT_QTRACS', @optname = N'publish', @value = N'true'GOuse [GT_QTRACS]GO-- Adding the transactional publicationexec sp_addpublication @publication = N'GT_QTRACS_compopt', @restricted = N'false', @sync_method = N'native', @repl_freq = N'continuous', @description = N'Transactional publication of GT_QTRACS.dbo.compopt table.', @status = N'active', @allow_push = N'true', @allow_pull = N'true', @allow_anonymous = N'false', @enabled_for_internet = N'false', @independent_agent = N'false', @immediate_sync = N'false', @allow_sync_tran = N'false', @autogen_sync_procs = N'false', @retention = 336, @allow_queued_tran = N'false', @snapshot_in_defaultfolder = N'true', @compress_snapshot = N'false', @ftp_port = 21, @ftp_login = N'anonymous', @allow_dts = N'false', @allow_subscription_copy = N'false', @add_to_active_directory = N'false', @logreader_job_name = N'SDDEVSQL3\GTW-GT_QTRACS-16'exec sp_addpublication_snapshot @publication = N'GT_QTRACS_compopt',@frequency_type = 4, @frequency_interval = 1, @frequency_relative_interval = 1, @frequency_recurrence_factor = 0, @frequency_subday = 8, @frequency_subday_interval = 1, @active_start_date = 0, @active_end_date = 0, @active_start_time_of_day = 0, @active_end_time_of_day = 235959, @snapshot_job_name = N'SDDEVSQL3\GTW-GT_QTRACS-GT_QTRACS_compopt-32'GOexec sp_grant_publication_access @publication = N'GT_QTRACS_compopt', @login = N'BUILTIN\Administrators'GOexec sp_grant_publication_access @publication = N'GT_QTRACS_compopt', @login = N'NA\qwbssqla'GOexec sp_grant_publication_access @publication = N'GT_QTRACS_compopt', @login = N'sa'GO-- Adding the transactional articlesexec sp_addarticle @publication = N'GT_QTRACS_compopt', @article = N'compopt', @source_owner = N'dbo', @source_object = N'compopt', @destination_table = N'compopt', @type = N'logbased', @creation_script = null, @description = null, @pre_creation_cmd = N'drop', @schema_option = 0x00000000000000F3, @status = 16, @vertical_partition = N'false', @ins_cmd = N'SQL', @del_cmd = N'SQL', @upd_cmd = N'SQL', @filter = null, @sync_object = null, @auto_identity_range = N'false'GO-- Adding the transactional subscriptionexec sp_addsubscription @publication = N'GT_QTRACS_compopt', @article = N'all', @subscriber = N'SDDEVSQL3\GTW', @destination_db = N'GT', @sync_type = N'automatic', @update_mode = N'read only', @offloadagent = 0, @dts_package_location = N'distributor'GOTara |
 |
|