I want to alter a column,A, that has datatype nvarchar(20) to nvarchar(40). But I have another column, B, that is computed with respect to column A. According to my research, at first I need to drop my calculated column B ,then alter column A and finally re-create column B. In this process, I am not sure that can I recover the old values in column B. Can anyone explain me what will happen or recommend better solution ? Thanks
Asked
Active
Viewed 33 times
0
-
2You will learn **FAR** more by simply creating a small test table and trying this. It is a trivial thing to do - and there is nothing special you need to do to "recompute" the same values. And now is a good time to verify that you have a disaster recovery plan and that you know how to make and restore backups. Because you should make a backup whenever you need to alter a database schema just in case something bad happens. – SMor Jun 07 '19 at 14:07
-
1If by calculated column you mean computed column, then it won't matter as long as you recreate it with the same expression. If the expression is the same the values will be the same. Even if it is persisted there will be no issue, it might just take a bit longer while the values are evaluated and stored. – GarethD Jun 07 '19 at 14:07