Solved

Modifying table in replication

Posted on 2004-03-25
5
1,259 Views
Last Modified: 2008-02-01
How can I easily rename fields in a table and not have trouble with replication?

--------------------------------------------------------------------------
'tblMyTable' table
- Unable to rename column from 'OldVal' to 'NewVal01'.  
ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot rename the table because it is published for replication.
--------------------------------------------------------------------------

0
Comment
Question by:risoy
  • 3
  • 2
5 Comments
 
LVL 13

Accepted Solution

by:
danblake earned 250 total points
ID: 10675294
Remove the table from the replicated setup, by using sp_droparticle, then rename the table/column and then readdit afterwards with sp_addarticle.

You can generate the sp_droparticle/sp_addarticle scripts by clicking in EM, the subscription database which the table is involved in and select generate sql script for create/drop to just grab the bits relating to this particular table with the drop/adds required.
0
 

Author Comment

by:risoy
ID: 10687627
Ergo there is no option while the table is in replication?
0
 
LVL 13

Expert Comment

by:danblake
ID: 10687707
That is correct.

You can drop the column then add the column (but this messes up the underlying table structures involved by using):
sp_repldropcolumn
sp_repladdcolumn

But you cannot rename fields without taking it out of the replication.

MS SQL Server does not support automatic full blown schema updates to multiple sites.
0
 

Author Comment

by:risoy
ID: 10688257
Could be handy in a redundant system that require 100% uptime. Hopefully in the future.

Thank you!
0
 
LVL 13

Expert Comment

by:danblake
ID: 10688463
Could be handy in a redundant system that require 100% uptime. Hopefully in the future.

Hopefully I'll get the chance to design something like this: using the Service Broker in Yukon / Trigers / and some other bits / bobs ....(I believe it can be made to work)
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Find results from sql within a time span 11 31
SQL view 2 27
ms sql + get number in list out of total 7 29
transaction in asp.net, sql server 6 33
When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how the fundamental information of how to create a table.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question