Question

I am using SQL Server 2008 R2.

I have a table which has several fields including a nvarchar(max) field.

When I try and add a new field of type varbinary(max) I get an error message: "Saving changes is not permitted. The change that you have made requires the following tables to be droped and recreated".

Is it possible to have a nvarchar(max) and a varbinar(max) fields in same table?

Is the only way to fix this, to create a new table with the new structure and transfer the data?

Was it helpful?

Solution

Yes it is possible.

If you are seeing this message you must have tried to insert the new column in the middle of existing ones in the SSMS table designer. Add it onto the end of the existing columns then the table won't have to be completely rebuilt.

Or just execute

alter table YourTable add newcol varbinary(max) null

OTHER TIPS

Yes of course - you probably just have this new "safety" option in SSMS still enabled (it's ON by default):

alt text

That's under Tools > Options ....

Go to Tools | Options > Designers and uncheck the option 'Prevent saving changes that require table re-creation'

SQL Server is not allowing you to evolve the table this way, because it cannot modify the storage for the existing table dynamically. If you want to do this, you have to create a new table with the new schema and populate it with the data from the original table.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top