Reputation: 2863
I'm trying to rename a column using sp_rename
but it's referenced in a computed column. I'm getting the following error:
'Table.Column' cannot be renamed because the object participates in enforced dependencies.
As far as I can tell the (persisted) computed column is the only place this is referenced. I guess I can drop and recreate the computed column since I won't technically be losing any data, but I wondered if there was a cleaner way?
Thanks
Phil
Upvotes: 0
Views: 1013
Reputation: 1
I have done it.
First you should open the table designer than change the computed column name from here right click on it and then click on generate change table script. copy the script and execute it.
it will rename the column without losing data
vimal lohani DBA | MCP(70-461)
Upvotes: 0
Reputation: 239764
Given the SSMS runs into exactly the same error, I'm thinking there's not a better way than dropping and recreating the computed column.
Upvotes: 2