What are the two virtual tables SQL Server maintains for
triggers?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / sri
The 2 virtual tables are the OLD and the NEW
OLD is invalid in the case of INSERT and NEW is invalid in
the case of DELETE statements
Inside the trigger we can use the OLD and NEW as follows
:OLD.columnname
:NEW.columnname
Is This Answer Correct ? | 3 Yes | 6 No |
Explain syntax for disabling triggers?
What is model database in sql server?
What is the difference between stored procedure and user defined functions?
How connect excel to sql server?
Explain system functions or built-in functions? What are different types of system functions?
What are the steps to take to improve performance of a poor performing query? : sql server database administration
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
What is the difference between IN and EXISTS operators in SQL Server?
9 Answers ASD Lab, CSC, Intelligroup,
What is the difference between lock, block and deadlock? : sql server database administration
What is the query and subquery?
why cluster and non clusterindex are used in sqlserver 2000? explain with example
What is a primary key?