Renamed Fields

SLarkinSLarkin Posts: 2 New member
edited March 5, 2019 7:26PM in SQL Compare
I'm trying to use SQL Compare (v. to generate deployment scripts for updating a set of tables based on a DDL script from the vendor. The vendor has changed some of the field names (don't get me started), and instead of adding the new-named column, I'd like to update the existing column, but I don't see a way of telling SQL Compare that this is what I want to do on a case-by-case basis. 

Is there a property or setting that I'm not seeing, or does anyone have a suggestion on how to solve my problem programmatically? I'd like to avoid doing this manually for 300 tables, if possible. This is a SQL Server 2014 db.


  • Sergio RSergio R Posts: 610 Rose Gold 5
    In most cases SQL Compare will already do this automatically, and will use the EXEC sp_rename command, I have tested this with the very latest version (13.7.4), but the behavior should be identical in the version that you are using:

    <div>PRINT N'Altering [dbo].[T1]'
    </div><div>IF @@ERROR <> 0 SET NOEXEC ON
    </div><div>EXEC sp_rename N'[dbo].[T1].[C2]', N'C4', N'COLUMN'</div>

    If this isn't happening in your case, please post some reproduction steps.

    There might be some SQL Compare options that change this behavior, apart from that the only way to do this would be to create a deployment script and then update the script manually.

    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools
Sign In or Register to comment.