DRAG DROP
You have two tables named UserLogin and Employee respectively.
You need to create a Transact-SQL script that meets the following requirements:
The script must update the value of theIsDeleted column for the UserLogin table to 1 if the value of the Id
column for the UserLogin table is equal to 1.
The script must update the value of the IsDeleted column of the Employee table to 1 if the value of the Id
column is equal to 1 for the Employee table when an update to the UserLogin table throws an error.
The error message “No tables updated!” must be produced when an update to the Employee table throws
an error.
Which five Transact-SQL segments should you use to develop the solution? To answer, move the appropriate
Transact-SQL segments from the list of Transact-SQL segments to the answer area and arrange them in the
correct order.
Select and Place:

The error message will not be produced when an update to the Employee table throws an error here . also an update to the UserLogin table will not throws any errors . either the question is wrong or choices in the answers are missing…
2
2
The answer is correct.
18
2
Indeed.
0
0
Let me rectify this , yes the answer is correct
4
2
Without losing seriousness in here, I would like to inform that I agree with you.
0
0
the answer is correct
5
2
HERMANOS DEL MUNDO TIENEN QUE LEER ,COMPRENDER Y RESOLVER….
BUENO ….THE ANSWER IS INCORRECT …WHY
BEGIN TRY
update db.UserLogin
set IsDeleted=1
where id=1
END TRY
BEGIN CATCH
BEGIN TRY
update db.Employee
set IsDeleted=1
where id=1
END TRY
BEGIN CATCH
RAISERROR(‘no tables updated’,16,1)
END CATCH
END CATCH
EL MENSAJE DE SALIDA ES:
(1 row(s) affected)
AHORA LA COMPROBACION Y LA RESPUESTA CORRECTA
CREATE TABLE db.UserLogin
(ID INT NOT NULL PRIMARY KEY CLUSTERED IDENTITY(1,1),
IsDeleted INT NOT NULL)
insert into db.UserLogin (IsDeleted)values(0),(0)
SELECT * FROM db.UserLogin
create TABLE db.employee
(
ID INT NOT NULL PRIMARY KEY CLUSTERED IDENTITY(1,1),
IsDeleted INT NOT NULL
CONSTRAINT checkEqualsZero CHECK (Isdeleted=0)
)
INSERT INTO DB.Employee (IsDeleted)VALUES (0),(0),(0)
——————————-
BEGIN TRY
update db.UserLogin
set IsDeleted=1
where id=1
END TRY
———————————–
BEGIN CATCH
————————————
END CATCH
—————————————-
BEGIN TRY
update db.Employee
set IsDeleted=1
where id=1
END TRY
———————————————————-
BEGIN CATCH
RAISERROR(‘no tables updated’,16,1)
END CATCH
—————————————–
GRACIAS…Y SIGAN COMPARTIENDO POR LA SENDA DEL CONOCIMIENTO
3
1