WHERE Status = @Status

You are a database developer on an instance of SQL Server 2008. You are creating a user-defined function to be used by the human resources department to identify the employee with the highest salary who meets other specific criteria.
You use the following statement to create the UDF:
CREATE FUNCTION dbo.udf_find_emp(@Commission money, @Status varchar(8) =’A’)
RETURNS int
WITH SCHEMABINDING, ENCRYPTION
AS
BEGIN
DECLARE @v_emp int;
SELECT @v_emp = EmpID
FROM dbo.Employee
WHERE Status = @Status
AND Commission > @Commission
AND Salary =(SELECT MAX(Salary)
FROM dbo.Employee
WHERE Status = @Status AND Commission > @Commission);
RETURN @v_emp
END
Which statement about the function is true?
A. The function can only be called from within the body of a stored procedure.
B. The function will never return a NULL value.
C. The function encrypts all parameter values passed to the function.
D. To call the function successfully without specifying the @Status parameter value, you must include the DEFAULT keyword in the function call.

microsoft-exams

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.