开发者

Altering a on attribute data size from a table in SQL Server

开发者 https://www.devze.com 2022-12-17 07:34 出处:网络
So I\'m trying to do something I thought would\'ve been straightforward. I have a table in the DB named \"Images.\" It\'s \'Description\' property is of type nvarchar(50). I simply want to make it nva

So I'm trying to do something I thought would've been straightforward. I have a table in the DB named "Images." It's 'Description' property is of type nvarchar(50). I simply want to make it nvarchar(250). Every time I try, it says it can't save because some tables would have to be redropped. I can't just delete it (i think) because, there's already data being maintained by it, and I can't lose it.

EDIT::

Exact error message

"Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving changes that require the table to be re-created."

Should I just disable the 'Prevent savi开发者_JS百科ng changes that require table re-creation' and save it from there.


This KB article explain it


Do you have any tables referencing the "Description" column? That would prevent you from changing the data type/length.


Were you doing this from the SSMS GUI or were you running a script using alter table to make the change? IF you did it through the designer, I believe it creates another table, drops the orginal and renames the new table. If that table is in a PK/FK relationship. it can't drop the table. Never make table changes except by using a script. YOu also need these to properly put them in source control as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号