Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 16, 2013 07:49 AM by sjnaughton
Jan 16, 2013 04:05 AM|LINK
can you show me an example of the computed columns?
Jan 16, 2013 07:49 AM|LINK
Hi jvdub22, below is an example of a computed column see this line [DORetirement] AS (dateadd(year,(60),[DOBirth])-(1)) PERSISTED remember this is all accomplished in the data base, I often use scalar vaued functions and pass in some (i.e.
value PK or FK column) and then access related tables for the values.
-- Create Table with computed column
CREATE TABLE [dbo].[CCtest]
[empNumb] [int] NULL,
[DOBirth] [datetime] NULL,
[DORetirement] AS (dateadd(year,(60),[DOBirth])-(1)) PERSISTED