The column “%.*ls” cannot be modified because it is either a computed column or is the result of a UNION operator

Error Message:
Msg 271, Level 16, State 1, Line 13
The column “%.*ls” cannot be modified because it is either a computed column or is the result of a UNION operator.

Severity level:
16.

Description:
This error message appears when during an UPDATE operation either the value for a computed column in a base table should be modified or this column the result of a statement is, that uses the UNION operator.

Consequences:
The T-SQL statement can be parsed, but causes the error at runtime.

Resolution:
Error of the Severity Level 16 are generated by the user and can be fixed by the SQL Server user. You must modify the UPDATE statement to not try to modifiy the computed column. Resp. the UNION statement must be modified.

Versions:
All versions of SQL Server

Example(s):
CREATE TABLE #t
(
 c1 INT
 , c2 INT
 , c3 AS c1 * c2
)

INSERT INTO #t SELECT 1, 2
UNION ALL SELECT 2, 4
SELECT *
  FROM #t

UPDATE #t
   SET c3 = 1
 WHERE c1 = 1
 
DROP TABLE #t

Remarks:
The above example tries to update the value of a computed column. Because this is an illegal operation, the error is raised.




Related Articles :

  • No Related Articles Found

No comments yet... Be the first to leave a reply!

Software Reviews | Book Reviews | FAQs | Tips | Articles | Performance Tuning | Audit | BI | Clustering | Developer | Reporting | DBA | ASP.NET Ado | Views tips | | Developer FAQs | Replication Tips | OS Tips | Misc Tips | Index Tuning Tips | Hints Tips | High Availability Tips | Hardware Tips | ETL Tips | Components Tips | Configuration Tips | App Dev Tips | OLAP Tips | Admin Tips | Software Reviews | Error | Clustering FAQs | Performance Tuning FAQs | DBA FAQs |