Groups | Blog | Home
all groups > sql server replication > august 2006 >

sql server replication : problem adding column to replication table using sp_repladdcolumn


Rich
8/7/2006 10:16:01 PM
Hello,

I tried adding a column to my test replication DB. Here is what I tried and
the error message I kept getting:

sp_repladdcolumn 'websubscribers', 'newcol', 'varchar(50)', 'pubwebsubscriber'

[quoted text, click to view]
ODBC: Msg 0, Level 19, State 1
SqlDumpExceptionHandler: Process 56 generated fatal exception c0000005
EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.

Connection Broken
<<

The column did not get added. So I tried adding the column manually through
EM. I added some data to the column, but it did not replicate - although the
original columns did still continue to replicate.

Then I tried to drop this new column but got this message - using
sp_repldropcol...

sp_repldropcolumn 'websubscribers', 'newcol'

[quoted text, click to view]
Server: Msg 5074, Level 16, State 1, Line 1
The object 'DF_WebSubscribers_NewCol' is dependent on column 'newcol'.
Server: Msg 4922, Level 16, State 1, Line 1
ALTER TABLE DROP COLUMN newcol failed because one or more objects access
this column.
<<

Any assistance greatly apprciated - Note: test replication system is running
on sql server 2000 personal edition on 2 separate instances of sql server

- will experiment with the real servers - sql server 2000 Standard edition
- tommorrow morning. I will create some test DBs on the publication server
and the subscriber server which are on separate machines.

Thanks,
Karthik
8/7/2006 11:07:02 PM
What service pack of SQL Server do you have?

Please refer to http://support.microsoft.com/?kbid=892451

[quoted text, click to view]
Rich
8/7/2006 11:10:01 PM
I forgot to mention that I also created the new column, manually, on the
subscriber database, and after replication took place, the new column would
get dropped each time on the subscriber database. What do I need to do so
that the new column does not get dropped?


[quoted text, click to view]
Karthik
8/7/2006 11:21:01 PM
Hi,

Ideally add the column using sp_repladdcolumn only at the publisher. Run the
snapshot agent at the publisher after that and then try synchronizing.... It
should work fine.

Avoid adding columns at the subscribers manually.

Regards,
Karthik

[quoted text, click to view]
Rich
8/7/2006 11:40:02 PM
Hi Karthik,

I have the latest service pack (svcpak4 I believe) which I loaded a couple
of years ago. Anyway, to run the sp on the publisher what I do is to go to
QA, use my replication database (not the distribution database - or is that
where I need to run the sp). Is my replication DB the publisher DB? Or is
the Distribution DB the publisher?

Thanks,
Rich

[quoted text, click to view]
Rich
8/8/2006 2:16:11 AM
OK. I figured it out.

sp_repladdcolumn 'websubscribers', 'newcol', 'varchar(50)'

I removed the publication argument at the end of the args list here. Now I
was not only able to create the new column in the publication table, it also
created the new column in the subscriber table on the other server and the
replication worked fine!

Thanks everyone for all the help.

Rich

[quoted text, click to view]
Rich
8/8/2006 8:06:04 AM
Greetings,

I am at the office now, so I will create a test resplication database and
see if I can get everything to work as published.

BTW, is there, are there SPs to identify what tables in a replication DB are
under replication - besides looking at the replication monitor?

Rich

[quoted text, click to view]
Paul Ibison
8/8/2006 9:34:28 AM
If you add the column through EM, it is not included in the views used by
replication and you'll have a vertically partitioned publication.
To remove the added column, it looks like you have a related default which
needs removing first.
Once you have got rid of the new column, please try:
sp_repladdcolumn 'websubscribers', 'newcol', 'varchar(50) NULL',
'pubwebsubscriber'
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com

Paul Ibison
8/8/2006 9:35:57 AM
The published database exists on the publisher, which is often the same
server as the distributor. The stored procedure needs to be run in the
published database on the publisher.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com

Paul Ibison
8/8/2006 10:25:53 AM
Rich,
the @publication_to_add argument should be fine so you might want to
continue investigating this one in the background, as the underlying issue
might have been skirted but still exist. First of all, I'd verify that the
SP4 is installed on all servers.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com

Rich
8/8/2006 10:41:02 AM
Thanks.

[quoted text, click to view]
Rich
8/8/2006 10:44:02 AM
Yes. I was able to do it with the publication name on the server at my
office. Things looking ok now.

Thanks to all for your help

Rich

[quoted text, click to view]
Paul Ibison
8/8/2006 4:24:56 PM
sp_helparticle with no argument for @article should do it for you.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com



AddThis Social Bookmark Button