You have a table named Table1 that stores customer data.
Each customer has a credit limit that can only be discovered by querying multiple tables.
You need to ensure that the value of the credit limit is returned by executing a query on Table1.
What should you create?
A.
A trigger that uses a ranking function
B.
A trigger that uses a table-valued function
C.
A calculated column that uses a table-valued function
D.
A calculated column that uses a scalar function
In my opinion the correct answer should be D. calculated column that uses a scalar function. Check this article out : https://www.mssqltips.com/sqlservertip/2481/getting-creative-with-computed-columns-in-sql-server/
Accessing a column outside of the computed column table
A computed column can not directly access any column outside its table. This limitation may be overcome by using a User Defined Function. A UDF may be used in the expression to access any column outside the computed column table.
In the script below, a UDF is created to calculate the employee leave balance to show how many remaining days of leave an employee has beyond the maximum of 20 days. This data comes from a secondary table named LeaveBalance.