Options

Computed column renaming

jstangroomejstangroome Posts: 26
edited May 24, 2006 7:35PM in SQL Compare Previous Versions
A portion of a script generated by SQL Compare 5.1 looks like this:

PRINT N'Altering [dbo].[doMaster]'
GO
sp_rename N'[dbo].[doMaster].[GLAccount]', N'GlAccount', 'COLUMN'
GO
@TRANCOUNT>0 ROLLBACK TRANSACTION
GO
@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
GO

Unfortunately it is failing with this error message:
Altering [dbo].[doMaster]
Msg 4928, Level 16, State 1, Procedure sp_rename, Line 520
Cannot alter column 'GLAccount' because it is 'COMPUTED'.

Will I need to hand-edit this part of the script?

Thanks,

- Jason

Comments

  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hello Jason,

    It may be helpful if you could tell us what SQL Compare is meant to be doing. Can you post up a bit more of the script? For instance, is this part of a table rebuild?
  • Options
    Hi Brian,

    This is purely a difference of case on a single column on two tables that are otherwise identical. It is not part of a rebuild.

    Thanks,

    - Jason
  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi Jason,

    It sounds like a new 'feature' added as part of the treat items as case sensitive option. It probably doesn't consider computed columns. I'll look more deeply into it tomorrow.
  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi Jason,

    I've reproduced and confirmed this as a bug. Someone will begin looking into fixing this little problem for a future version of SQL Compare.

    When you use the 'treat items as case-sensitive' option and a column name exists in two tables in the databases you're comparing and the column name differs only in case, SQL Compare will rather intelligently use sp_rename. This doesn't seem to work on computed columns, though, for the reason you have pointed out.

    Thanks!
  • Options
    Excellent. Having only purchased the SQL Bundle in the past week I am very impressed by the response times to the occasional hiccup in the software I have experienced.

    Thank you.
Sign In or Register to comment.