Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Add article to Replication

Author  Topic 

albertkohl
Aged Yak Warrior

740 Posts

Posted - 2009-07-02 : 00:29:51

hello, i'm playing with replication, and i was wondering if there's any way to add a new article to an existing publication

for example if the following table is added:

USE [MyDB]
GO

CREATE TABLE [dbo].[test_tbl](
[zip] [varchar](5) NOT NULL,
CONSTRAINT [PK_test_tbl] PRIMARY KEY CLUSTERED
([zip] ASC) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]
GO
insert into test_tbl (zip) values ('12345')
go

alter table test_tbl add [msrepl_tran_version] [uniqueidentifier] NOT NULL default (newid())
go

ALTER TABLE [dbo].[test_tbl] WITH NOCHECK ADD CONSTRAINT [repl_identity_range_tran_test_tbl] CHECK NOT FOR REPLICATION (([zip]>(20000) AND [zip]<(21000)))
ALTER TABLE [dbo].[test_tbl] CHECK CONSTRAINT [repl_identity_range_tran_test_tbl]
GO


Okay, now i wanna add it to MyReplication as a new article, BUT i dont want it to create a whole new snapshot, just simply add this new table into the next update...

any help would be greatly appreciated

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2009-07-07 : 22:39:13
check out books online for sp_Addarticle. also check out the different parameters ...

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

albertkohl
Aged Yak Warrior

740 Posts

Posted - 2009-07-07 : 22:42:12
sweet thanks!

also, is there any reason why the snapshot on a merge replication hanges up? it keeps hanging on waiting for a response from the server 0% once i start the publisher... :( database is about 20gb so i dont know if that's why.
Go to Top of Page
   

- Advertisement -