Exam DP-203 All QuestionsBrowse all questions from this exam
Question 215

DRAG DROP

-

You are batch loading a table in an Azure Synapse Analytics dedicated SQL pool.

You need to load data from a staging table to the target table. The solution must ensure that if an error occurs while loading the data to the target table, all the inserts in that batch are undone.

How should you complete the Transact-SQL code? To answer, drag the appropriate values to the correct targets. Each value 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.

NOTE: Each correct selection is worth one point.

    Correct Answer:

Discussion
OfficeSaracus

Given answer is wrong. It should be BEGIN TRAN as SQL pool in Azure Synapse Analytics does not support distributed transaction. https://learn.microsoft.com/en-us/azure/synapse-analytics/sql-data-warehouse/sql-data-warehouse-develop-transactions "Limitations SQL pool does have a few other restrictions that relate to transactions. They are as follows: No distributed transactions No nested transactions permitted No save points allowed No named transactions No marked transactions No support for DDL such as CREATE TABLE inside a user-defined transaction " Distributed Transactions are only allowed in SQL Server and Azure SQL Managed Instance: https://learn.microsoft.com/de-de/sql/t-sql/language-elements/begin-distributed-transaction-transact-sql?view=sql-server-ver16

janaki

Its BEGIN TRAN then ROLLBACK TRAN

e56bb91

ChatGPT 4o code: BEGIN TRANSACTION; BEGIN TRY -- Insert data from staging table to target table INSERT INTO target_table (column1, column2, ...) SELECT column1, column2, ... FROM staging_table; -- Commit the transaction if no error occurs COMMIT TRANSACTION; END TRY BEGIN CATCH -- Rollback the transaction if an error occurs ROLLBACK TRANSACTION; -- Optionally, you can log the error or re-throw it -- SELECT ERROR_MESSAGE() AS ErrorMessage; -- THROW; END CATCH;

Alongi

BEGIN TRAN ROLLBACK TRAN

be8a152

BEGIN TRAN & ROLLBACK TRAN

Ram9198

It should be BEGIN TRAN and ROLLBACK TRAN

kkk5566

BEGIN TRAN ROLLBACK TRAN