PrepAway - Latest Free Exam Questions & Answers

Which five Transact-SQL segments should you use to deve…

DRAG DROP
You are creating a stored procedure which will insert data into the table shown in the Database schema exhibit.
(Click the exhibit button.)

You need to insert a new customer record into the tables as a single unit of work.
Which five Transact-SQL segments should you use to develop the solution? To answer, move the appropriate
Transact-SQL segments to the answer area and arrange the, in the correct order.
NOTE: More than one order of answer choices is correct. You will receive credit for any of the correct orders
you select.
Select and Place:

PrepAway - Latest Free Exam Questions & Answers

Answer:

Explanation:
The entities on the many side, of the 1-many relations, must be added before we add the entities on the 1-side.We must insert new rows into BusinessEntityContact and BusinessEntityAddress tables, before we insert the
corresponding rows into the BusinessEntity and AddressType tables.

5 Comments on “Which five Transact-SQL segments should you use to deve…

  1. VikNik says:

    I think: first we need to populate tables that have PK AddressType.AddressTypeID and BusinessEntity.BusinessEntityID then we will be able to populate BusinessEntityAddress and BusinessEntityContact tables that have FK constraints with AddressType and BusinessEntity tables.




    30



    3
    1. insomniumbr says:

      The question says five statements.
      Two statements are required: BEGIN TRAN / COMMIT TRAN.
      We are creating a Person right? Not a new Address Type.
      My I would go with:

      BEGIN TRAN
      INSERT INTO PERSON.BusinessEntity
      INSERT INTO PERSON.BusinessEntityContact
      INSERT INTO PERSON.BusinessEntityAddress
      COMMIT TRAN




      16



      1
    1. xincheng888 says:

      I agree. Also I think you just need insert PK tables, then insert FK tables. However you can change insert order on both PK tables and FK tables. For example, you can insert data to AddressType table as the first step but you also can insert data to BusinessEntity table as the first step. It is a bad design on both database modeling and business logic.




      1



      0

Leave a Reply