Understanding computed columns
Not only can you insert data directly into columns, but you can also derive columns from other columns. These columns are known as computed columns. Typically, computed columns will extend or enhance the data that is stored in traditional columns.
Add a computed column using SSMS
Ensure that SSMS is open and you are connected to your server.
Expand the Databases folder.
Expand the SBSChp4SSMS database.
Expand the Tables folder.
Right-click the HumanResources.Employee table and select Design.
Under Gender, in the next row, type FullName and press the Tab key.
In the Column Properties section at the bottom of the table designer screen, locate and expand the Computed Column Specification property.
In the Formula property, type LastName+’, ’+FirstName.
Add a computed column using T-SQL
Open the query editor in SSMS.
In the query editor, enter and execute the following T-SQL code:
--Use this code to add the Gender column to the Employee table USE SBSChp4TSQL; ALTER TABLE HumanResources.Employee ADD FullName AS LastName+', '+FirstName;