PrepAway - Latest Free Exam Questions & Answers

Which six Transact-SQL statements should you use?

DRAG DROP
You use Microsoft SQL Server 2012 to develop a database application.
You create two tables by using the following table definitions.

Which six Transact-SQL statements should you use? (To answer, move the appropriate SQL
statements from the list of statements to the answer area and arrange them in the correct order.)

PrepAway - Latest Free Exam Questions & Answers

Answer:

Explanation:

5 Comments on “Which six Transact-SQL statements should you use?

  1. Kristina says:

    CREATE FUNCTION dbo.getsubtree(@empid AS int)
    RETURNS @Tree TABLE(
    empid int NOT NULL,
    empname varchar(25) NOT NULL,
    mgrid int NULL,
    lvl int NOT null
    )
    AS BEGIN
    WITH Employees_Subtree(empid, empname, mgrid, lvl)
    AS
    (
    SELECT empid, empname, mgrid, 0
    FROM Employees WHERE empid=@empid
    UNION ALL
    SELECT e.empid, e.empname, e.mgrid, es.lvl+1
    FROM employees AS e
    JOIN Employees_SubTree AS es
    ON e.mgrid=es.empid
    )
    INSERT INTO @Tree
    SELECT * form Employees_Subtree;
    RETURN
    END




    0



    0

Leave a Reply