Is this a bug or undocumented expected behaviour - sp_rename.

  • Using SQLServer2008R2 10.0.5841

    create table t (c1 int primary key, c2 int, c3 as 1*2)

    insert into t values (1,2)

    create index i on t (c2)

    create index j on t (c3)

    go

    sp_rename @objname = 'dbo.t.c1' , @newname = 'c1a' , @objtype = 'COLUMN'

    go

    sp_rename @objname = 'dbo.t.c2' , @newname = 'c2a' , @objtype = 'COLUMN'

    go

    sp_rename @objname = 'dbo.t.c3' , @newname = 'c3a' , @objtype = 'COLUMN'

    go

    Output ....

    Caution: Changing any part of an object name could break scripts and stored procedures.

    Caution: Changing any part of an object name could break scripts and stored procedures.

    Caution: Changing any part of an object name could break scripts and stored procedures.

    Msg 4928, Level 16, State 1, Procedure sp_rename, Line 547

    Cannot alter column 'c3' because it is 'COMPUTED'.

    Msg 0, Level 20, State 0, Line 0

    A severe error occurred on the current command. The results, if any, should be discarded.

    The I get the connection blown away.

  • sp_rename won't work on computed columns. Probably have to drop and recreate it. The caution/warning messages are normal output of sp_rename.

    The probability of survival is inversely proportional to the angle of arrival.

  • Well, pretty obviously it doesn't work or I wouldn't have posted.

    This limitation does not appear to be documented, and a catastrophic failure with subsequent disconnect is hardly an appropriate output/result from a supported sp, ever.

    Way to go MS, this is a fine example of the quality software and documentation we have come to expect!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply