Sunday, November 7, 2010

Computed Columns

*A computed column cannot be the target of an INSERT or UPDATE statement.
*Unless otherwise specified, computed columns are virtual columns that are not physically stored in the table. Their values are recalculated every time they are referenced in a query.
It is an error to insert values for computed
columns in a database :
Create Table #Test (a int, b int, C as a+b )
go
insert into #test values (1,2,5)
go
Msg 213, Level 16, State 1, Line 1
Column name or number of supplied values does not match table definition.


*PERSISTED Keyword is used to persist the computed columns in database.

No comments:

Post a Comment

 using Microsoft.AspNetCore.Mvc; using System.Xml.Linq; using System.Xml.XPath; //<table class="common-table medium js-table js-stre...