Which Transact-SQL segment should you insert at line 07?

Posted by: Pdfprep Category: 70-764 Tags: , ,

You have a database that stores information for a shipping company.

You create a table named Customers by running the following Transact-SQL statement. (Line numbers are included for reference only.)

You need to ensure that salespeople can view data only for the customers that are assigned to them.

Which Transact-SQL segment should you insert at line 07?
A . RETURNS varchar(20)WITH Schemabinding
B . RETURNS dbo.CustomersORDER BY @salesPerson
C . RETURNS tableORDER BY @salesPerson
D . RETURNS tableWITH Schemabinding

Answer: D

Explanation:

The return value can either be a scalar (single) value or a table. SELECT 1 just selects a 1 for every row, of course.

What it’s used for in this case is testing whether any rows exist that match the criteria: if a row exists that matches the WHERE clause, then it returns 1, otherwise it returns nothing. Specify the WITH SCHEMABINDING clause when you are creating the function. This ensures that the objects referenced in the function definition cannot be modified unless the function is also modified.

References: https://docs.microsoft.com/en-us/sql/t-sql/statements/create-function-transact-sql

Leave a Reply

Your email address will not be published.