Environment: SQL Server 2008 R2
Problem: The update or insert of the view or function ' XXX ' failed because it contains a derived domain or a constant field to resolve
To create a view command:
Create View D_s_g (Sno,avg_grade)
as
select Sno,avg (grade) from
SC
Group by Sno;
Reason: Views view does not allow modification.
Workaround: Recreate a table with the same structure content.
Execute the following command:
--d_s_t is the table name, D_s_g is the view name
SELECT * into d_s_t from D_s_g where 1<>1 inserts into the
d_s_t select * from D_s_g
Description: The table name (d_s_t) is different from the previous table name and view name because it is a SQL Server object.
Explanation: This is a view mechanism because the view that is created has other formal changes that are calculated for its property values, and changes to the view are ultimately manifested as changes to the table that do not exist in the table, or properties that are not the same in nature.