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 |
What is an indexing strategy?
Hi Friends, I have a table in which there are thousands of records and in city field there is NULL value for all records now i want to change that null value with distinct values in each record say delhi, bihar, agra, jaipur etc, what will be the query for that????? its not possible to update thousands of records one by one. is there any alternative ...? Plz help ... its urgent Thanx in advance
What is meant by Active-Passive and Active-Active clustering setup?
What is a join and their types?
2 Answers Challenger Financial,
Does hive support indexing?
What do you understand by mirroring?
What is difference between equi join and natural join?
What are the triggers in sql?
What is full form of XP ?
42 Answers Cap Gemini, Infosys, Microsoft, Oracle, Reliance,
What is self contained scalar sub query?
select empid empname from employee What is the result for the about query?
The external application that is executed in one of the tasks does not have a log file, but only a screen log. How can I save the data from the screen? : sql server management studio