Sql Server Interview Questions and Answers | What are triggers , inserted and deleted tables |Part 3

Описание к видео Sql Server Interview Questions and Answers | What are triggers , inserted and deleted tables |Part 3

Sql Server Tricky Interview Questions and Answers

--Query--
Create Table updateTrigger_Part3
(
id int primary key,
name varchar(20),
gender varchar(20)
)
Insert Into updateTrigger_Part3
Select 1,'Susheel','M'
Union
Select 2,'Ravindra','M'
Union
Select 3,'Saket','M'
Union
Select 4,'JP','M'
Union
Select 5,'Manisha','F'
Union
Select 6,'Shubhangi','F'

Select * from updateTrigger_Part3

Create Trigger Trg_updatetrigger_update
On updatetrigger_part3
After update
As
Begin
Update updatetrigger_part3
Set gender=Case When gender='F' Then 'M' Else 'F' End
End

--------------------------------------------
Update updatetrigger_part3
Set gender=Case When gender='F' Then 'M' Else 'F' End
--------------------------------------------

Комментарии

Информация по комментариям в разработке