DRAG DROP
You have an Azure SQL Database that contains two tables named Country and City.
You need to insert a country into the Country table and a city into the City table. The solution must meet the
following requirements:
If an error occurs while attempting to add the country, the city must NOT be added.
If an error occurs while attempting to add the city, the country must NOT be added.
How should you complete the code? To answer, drag the appropriate code blocks to the correct locations in the
answer area. Each code block may be used once, more than once, or not at all. You may need to drag the split
bar between panes or scroll to view content.
Select and Place:
Explanation:
https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqltransaction(v=vs.110).aspx
save(“insert”)
rollback(“insert”)
commit()
rollback(“beginning”)
No, I think the original answer is correct. Rolling back to “inserted” state instead of “beginning” after the insert of city fails will result in the country being added to the database. Requirements state that should not be the case.
agree
seems it does not need save(“insert”) at all.
me too