Search code examples
sql-serversql-server-2008-r2varcharmaxvarbinarymax

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


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?


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