PrepAway - Latest Free Exam Questions & Answers

Which six Transact-SQL statements should you use?

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:

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

  1. Kevin says:

    Merge CountryRegion as target
    Using(select @CountryRegionCode,@Name) as source(CountrtRegionCode,Name)
    On (target.CountrtRegionCode=source.CountrtRegionCode)
    When not matched by target then
    Insert into CountryRegion
    (CountrtRegionCode,Name)
    Values(@CountryRegionCode,@Name)
    When matched then update set name=source.Name




    0



    0
  2. mamku2005 says:

    The answer is correct

    CREATE FUNCTION [dbo].[getsubtree](@empid AS INT)
    RETURNS @Tree TABLE(empid INT NOT NULL,
    empname VARCHAR(25) NOT NULL,
    mgrid INT NOT NULL,
    M INT NOT NULL)
    AS
    BEGIN
    WITH Employees_Subtree(empid,empname,mgrid,M)
    AS
    (SELECT empid,empname,mgrid,0
    FROM Employees WHERE empid=@empid
    UNION ALL
    SELECT e.empid,e.empname,e.mgrid,es.M+1
    FROM Employees AS e JOIN Employees_Subtree AS es ON e.mgrid=es.empid
    )
    INSERT INTO @Tree
    SELECT * FROM Employees_Subtree
    RETURN
    END
    GO




    0



    0

Leave a Reply