"So every Insert or Update that attempts to change this column name fails."
If this is the case, I would rather suggest to go for a computed column over creating this as a physical column in your table.
CREATE TABLE ABCD
(
MyColumn1 INT
,MyColumn2 AS 1
);
INSERT INTO ABCD
SELECT 1
SELECT * FROM ABCD
If you try to modify this computed column you will get error message:
INSERT INTO ABCD(MyColumn1, MyColumn2)
SELECT 1, 2
Msg 271, Level 16, State 1, Line 1
To read more about computed column click here
The column "MyColumn2" cannot be modified because it is either a computed column or is the result of a UNION operator.
If this post answers your query, please click "Mark As Answer" or "Vote as Helpful".
No comments:
Post a Comment