What are the two virtual tables SQL Server maintains for
triggers?

Answer Posted / sanjeev kumar

Two virtual tables are:
1) Inserted
2) Deleted

these two tables are also called magic table.
it has no any physical existence. it is used to keep trac of
the previous data when DML operation used.
it's used in a trigger.

Example:
Create trigger testtri on test3
for update
as
begin
declare @previousname varchar(50) -- local variable
select @previousname = del.name from deleted del
insert into test(name)values(@previousname)
end

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is table-valued sub query?

564


Data is not being delivered to subscribers, what can be the possible reasons? : sql server replication

539


How to disconnect from a sql server using mssql_close()?

587


I applied Transactional with updatable subscriptions replication on 2 tables now i want to delete those 2 tables but i cannot delete those tables as replication is running how can i stop replication for those 2 tables(but i don't want to delete those replicated tables but i need to stop the replication) how can i do that

1435


Why do we use trigger?

552






Can we linked SharePoint to a SQL database?

587


What guidelines should be followed to help minimize deadlocks?

502


What is RMS migrations?

1698


Does partitioning ssd reduce performance?

488


What is user defined stored procedures?

560


what are the different stages of Report Processing?

97


What is an inner join?

526


Which sql server table is used to hold the stored procedure script?

475


What is the data type of time?

513


How would you add a section to a table?

562