Solved

Modifying table in replication

Posted on 2004-03-25
5
1,264 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

688 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