How to alter rep column sql server

SVA 116 Reputation points
2023-03-19T10:13:42.51+00:00

Hi

Please let me know the steps to alter a table column size which is already part of transactional replication.

Thanks

SQL Server Other
{count} votes

3 answers

Sort by: Most helpful
  1. LiHongMSFT-4306 31,566 Reputation points
    2023-03-20T01:55:44.92+00:00

    Hi @SVA

    You should be able to make DDL changes as described in this article: Make Schema Changes on Publication Databases.

    Also, you could use T-SQL: How to: Replicate Schema Changes (Replication Transact-SQL Programming).

    For more details, please refer to Kin's answer in this similar thread: Transactional replication altering tables and adding stored procedures.

    Best regards,

    Cosmog Hong


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Bjoern Peters 8,921 Reputation points
    2023-03-20T02:07:33.1566667+00:00

    Hi SVA,

    If it is not an XML-Datatype-Column and you are allowing schema changes within your setup to be published... you are good to go... change it ;-)

    More about the requirements and constraints you can find here...

    https://learn.microsoft.com/en-us/sql/relational-databases/replication/publish/make-schema-changes-on-publication-databases?view=sql-server-ver16

    I hope my answer is helpful to you,

    Your

    Bjoern Peters

    If the reply was helpful, please upvote and/or accept it as an answer, as this helps others in the community with similar questions. Thanks!

    0 comments No comments

  3. SVA 116 Reputation points
    2023-03-29T10:44:55.7333333+00:00

    Hi,

    Whether these step is fine to change the column size

    exec sp_droparticle

    alter table alter column -- to change the length

    exec sp_addarticle


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.