--從TSQL2014的Disk based資料表,建立發行集
use [TSQL2014]
exec sp_addpublication @publication = N'trxDisk2Memory', @description = N'來自發行者 ''MIA-SQL2016D'' 的資料庫 ''TSQL2014'' 交易式發行集。', @sync_method = N'concurrent', @retention = 0, @allow_push = N'true', @allow_pull = N'true', @allow_anonymous = N'true', @enabled_for_internet = N'false', @snapshot_in_defaultfolder = N'true', @compress_snapshot = N'false', @ftp_port = 21, @allow_subscription_copy = N'false', @add_to_active_directory = N'false', @repl_freq = N'continuous', @status = N'active', @independent_agent = N'true', @immediate_sync = N'true', @allow_sync_tran = N'false', @allow_queued_tran = N'false', @allow_dts = N'false', @replicate_ddl = 1, @allow_initialize_from_backup = N'false', @enabled_for_p2p = N'false', @enabled_for_het_sub = N'false'
GO
exec sp_addpublication_snapshot @publication = N'trxDisk2Memory', @frequency_type = 1, @frequency_interval = 1, @frequency_relative_interval = 1, @frequency_recurrence_factor = 0, @frequency_subday = 8, @frequency_subday_interval = 1, @active_start_time_of_day = 0, @active_end_time_of_day = 235959, @active_start_date = 0, @active_end_date = 0, @job_login = null, @job_password = null, @publisher_security_mode = 0, @publisher_login = N'miareplicate', @publisher_password = N''
--這部分最重要就是@schema_option選項,需要加入0x40000000000
use [TSQL2014]
exec sp_addarticle @publication = N'trxDisk2Memory', @article = N'Categories',
@source_owner = N'Production', @source_object = N'Categories', @type = N'logbased',
@description = N'', @creation_script = null, @pre_creation_cmd = N'drop',
@schema_option = 0x00000C000803508F,
@identityrangemanagementoption = N'manual',
@destination_table = N'Categories', @destination_owner = N'Production',
@vertical_partition = N'false',
@ins_cmd = N'CALL sp_MSins_ProductionCategories',
@del_cmd = N'CALL sp_MSdel_ProductionCategories',
@upd_cmd = N'SCALL sp_MSupd_ProductionCategories'
GO