Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Save changes is not permitted" when changing an existing column to be nullable

Tags:

sql

ssms

nullable

I've got a SQL Database Table, which has 35 existing records. One of the fields in this table is called Name, nvarchar(100), not null

However, due to a recent change, I need to make this column nullable.

When I change the column to allow nulls in SQL Server Management Studio, and go to save my changes, I get the following error:

Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created

How can I allow this to automatically be dropped and re-created?

like image 617
Curtis Avatar asked Oct 10 '11 09:10

Curtis


People also ask

How do I change a column to nullable in MySQL?

The value 0 is displayed, since we haven't added any value while using INSERT command above. Here is the syntax to allow NULL value. alter table yourTableName modify column yourColumnName datatype; Apply the above syntax to modify the column to allow NULL.

Can we add a NOT NULL column to an existing table?

You can add a not null column at the time of table creation or you can use it for an existing table. In the above table, we have declared Id as int type that does not take NULL value. If you insert NULL value, you will get an error.


2 Answers

I've found the solution. Go to "Tools > Options > Designers > Table and Database Designers":

enter image description here

like image 131
Curtis Avatar answered Nov 08 '22 22:11

Curtis


It's a setting in SSMS.

Tools - Option - Designers - Prevent saving changes that require table re-creation

like image 32
Mikael Eriksson Avatar answered Nov 08 '22 21:11

Mikael Eriksson