473,386 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Cannot Alter Table being Published for Replication


Hi all,

I'm using SQL Server 2000 SP3 to store data for real time transaction
processing.

I have set up replication to another server using a push subscription to
give me immediate backup.

I need to alter the data type of one of the columns and am using the
following basic sql:
alter table Voucher
alter column SerialNumber varchar(20) NOT NULL

However I keep getting this error message:

Server: Msg 4929, Level 16, State 1, Line 1
Cannot alter the table 'Terminals' because it is being published for
replication.

Is there anything I can do to allow this update taking place, short of
deleting the subscription and recreating it. (I want to try and avoid
this as the same update needs to be applied to about 10 databases that
are also replicated in the same way).

All help is appreciated.

Brian.

*** Sent via Developersdex http://www.developersdex.com ***
Jun 8 '06 #1
4 23765
1) Drop subscription to a specific article that you want to alter,
using sp_dropsubscription.
2) Drop this article using sp_droparticle.
3) Alter your table.
4) Add the article back to publication, using sp_addarticle.
5) Subscribe to this article using sp_addsubscription.
6) Run the snapshot agent to deliver the modified table to the
subscriber.


Brian Wotherspoon wrote:
Hi all,

I'm using SQL Server 2000 SP3 to store data for real time transaction
processing.

I have set up replication to another server using a push subscription to
give me immediate backup.

I need to alter the data type of one of the columns and am using the
following basic sql:
alter table Voucher
alter column SerialNumber varchar(20) NOT NULL

However I keep getting this error message:

Server: Msg 4929, Level 16, State 1, Line 1
Cannot alter the table 'Terminals' because it is being published for
replication.

Is there anything I can do to allow this update taking place, short of
deleting the subscription and recreating it. (I want to try and avoid
this as the same update needs to be applied to about 10 databases that
are also replicated in the same way).

All help is appreciated.

Brian.

*** Sent via Developersdex http://www.developersdex.com ***


Jun 8 '06 #2

"Brian Wotherspoon" <bw**************@yahoo.co.uk> wrote in message
news:zj*************@news.uswest.net...

Hi all,
Try sp_repladdcolumn.

Generally in a case like this, I make it a multi-step process.

sp_repladdcolumn and add say "SerialNumberTemp"

Then update the published table so SerialNumberTemp= SerialNumber.

Then, sp_repldropcolumn on SerialNumber

then add it the way I want.

Then copy the data back

Then drop the temp column.
I'm using SQL Server 2000 SP3 to store data for real time transaction
processing.

I have set up replication to another server using a push subscription to
give me immediate backup.

I need to alter the data type of one of the columns and am using the
following basic sql:
alter table Voucher
alter column SerialNumber varchar(20) NOT NULL

However I keep getting this error message:

Server: Msg 4929, Level 16, State 1, Line 1
Cannot alter the table 'Terminals' because it is being published for
replication.

Is there anything I can do to allow this update taking place, short of
deleting the subscription and recreating it. (I want to try and avoid
this as the same update needs to be applied to about 10 databases that
are also replicated in the same way).

All help is appreciated.

Brian.

*** Sent via Developersdex http://www.developersdex.com ***

Jun 9 '06 #3

"Eugene" <ek*****@gmail.com> wrote in message
news:11**********************@c74g2000cwc.googlegr oups.com...
1) Drop subscription to a specific article that you want to alter,
using sp_dropsubscription.
2) Drop this article using sp_droparticle.
3) Alter your table.
4) Add the article back to publication, using sp_addarticle.
5) Subscribe to this article using sp_addsubscription.
6) Run the snapshot agent to deliver the modified table to the
subscriber.
Problem with this I believe is that if you go this route, if data in other
articles is modified, when you resubscribe, you'll lose the data or have
problems with it in the other articles.


Brian Wotherspoon wrote:
Hi all,

I'm using SQL Server 2000 SP3 to store data for real time transaction
processing.

I have set up replication to another server using a push subscription to
give me immediate backup.

I need to alter the data type of one of the columns and am using the
following basic sql:
alter table Voucher
alter column SerialNumber varchar(20) NOT NULL

However I keep getting this error message:

Server: Msg 4929, Level 16, State 1, Line 1
Cannot alter the table 'Terminals' because it is being published for
replication.

Is there anything I can do to allow this update taking place, short of
deleting the subscription and recreating it. (I want to try and avoid
this as the same update needs to be applied to about 10 databases that
are also replicated in the same way).

All help is appreciated.

Brian.

*** Sent via Developersdex http://www.developersdex.com ***

Jun 9 '06 #4
I have a table called 'cursos' with a field called 'DiasCorridos' nvarchar(50) which i would like to change to 'int'. I can not see through Enterprise manager the name of the publication or the subscriber. So i do not know how to apply this script:
1) Drop subscription to a specific article that you want to alter,
using sp_dropsubscription.
2) Drop this article using sp_droparticle.
3) Alter your table.
4) Add the article back to publication, using sp_addarticle.
5) Subscribe to this article using sp_addsubscription.
6) Run the snapshot agent to deliver the modified table to the
subscriber.
Jul 28 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Heist | last post by:
Hi, I just want to know to turn this: CREATE TABLE . ( NOT NULL , (50) COLLATE French_CI_AS NULL , NOT NULL , (50) COLLATE French_CI_AS NOT NULL , NULL , NULL ) ON into this:
8
by: David Housman | last post by:
Hi, I'm trying to write a function check if a column exists on a table, and creates it if it doesn't. The line that the query analyzer is citing is noted. It seems unhappy taking variables in...
1
by: Rajesh Kumar Mallah | last post by:
Hi , Looks like ADD UNIQUE( some_fuc( some_feild) ) is not supported with add constraint. the only way is to add the constriant is using UNIQUE INDEX . Is it a bug or intended behaviour? ...
10
by: Jane | last post by:
Does any one know why this statement is failing? db2 => ALTER TABLE ELMT_T ALTER COLUMN CDTY_CD SET DATA TYPE VARCHAR(51) DB21034E The command was processed as an SQL statement because it was...
10
by: BuddhaBuddy | last post by:
Platform is DB2/NT 7.2.9 The table was created like this: CREATE TABLE MYTEST ( MYTESTOID bigint not null primary key, FK_OTHEROID bigint not null references other, FK_ANOTHEROID bigint not...
3
by: Jeff Kish | last post by:
Hi. I'm getting errors like this when I try to run an upgrade script I'm trying to write/test: altering labels to length 60 Server: Msg 5074, Level 16, State 4, Line 5 The object...
3
by: moskie | last post by:
Is there a way to run an alter table statement that adds a constraint for a foreign key, but does *not* check the existing data for refrential integrity? I'm essentially looking for the equivalent...
1
by: vasilip | last post by:
I'm testing out db2 for a project I'm starting that requires proper xml support and I can't seem to get both xml and spatial data to work well in the same table. Once having created a table...
5
by: Giacomo | last post by:
Hi, I’ve the following error message: --------------- ALTER TABLE . ALTER COLUMN varchar(10) Go Server: messaggio 4929, livello 16, stato 1, riga 1
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.