SQL Server > Table

Computed column in SQL Server

How to create computed column (eg. Salary column = Ctc column – Pf column = Net column) in SQL Server?

To create a Computed column in in SQL Server, open the table in design view and add a column and go to Column Properties. Explore Computer Column Specification and write the Formula.

In this case, we have written computed column as NetSalary whose value is Salary column value – PPFDeduction column value.

While inserting record for this database table, we do not need to write data for NetSalary column, writing value in Salary and PPFDeduction automatically calculates the NetSalary value.

 Views: 1611 | Post Order: 24

Write for us