?
Solved

Modifying table in replication

Posted on 2004-03-25
5
Medium Priority
?
1,266 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 1000 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Suggested Courses

800 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