SQL Server common errors and their solutions

1. Save changes are not allowed.

Modifying the data type of a field and clicking the save button sometimes pops up: Not allowed to save changes. Your changes require that the following tables be dropped and recreated. You have made changes to a table that cannot be recreated or enabled the "Prevent saving changes that require table re-creation" option.

Workaround: Uncheck the option to "Prevent saving changes that require table re-creation".

a. Find SQL Server Management Studio Express--->Tools->Options;

b. Select "Designer" (or designers) in the directory tree on the left and uncheck "Prevent saving changes that require table re-creation" on the right .

 

2. ALTER TABLE DROP COLUMN xxx failed because one or more objects accessed this column.

Error when modifying or deleting a column of the table:
Object 'DF_tablexxx_xxx' depends on column 'xxx'.
ALTER TABLE DROP COLUMN xxx failed because one or more objects accessed this column.

This is because there is a constraint on the column that is dropped.

Workaround: Delete the constraint first and then modify/delete the field.

查看约束:select   *   from  sysobjects where xtype='D' and parent_obj=object_id(‘table1');

Delete constraint: alter table employee drop constraint DF_tablexxx_xxx

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326613101&siteId=291194637