What are the magic tables in SQL Server 2000?

Answer Posted / ajay sadyal

Hi Friends

Magic table are created when we execute the DML statement
like insert,update and delete on database..

But these magic table are not accessible directly.You can
access these table only with triggers.
Becuase these table are only in the scope of triggers.

e.g deleted and inserted are two magic table..

CREATE TRIGGER [dbo].[EMPLOYEE_trgU]
ON [dbo].[EMPLOYEE]
FOR UPDATE AS
BEGIN
declare @name varchar(40)

SELECT @name = name from deleted WTIH (NOLOCK)

-- WITH (NOLOCK) enforce the sql-server not to Lock -
-- the data if there is any transaction implemented.

-- Now Update it with another table

UPDATE tbl_employee_log
SET description = @name + ' record has been deleted
from database'


END

Hope this will help.

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do you know what is a trace frag? Where do we use it?

716


What language is sql server written in?

720


What factors you will consider calculating the storage requirement for that view?

699


What is measure group, measure? : sql server analysis services, ssas

760


what's new in sql server 2016?

727






Explain what is public role in sql server?

786


Why do you want to join software field as you have done your BE in Electronics?

1889


What are different types of roles provided by ssrs?

128


What are the differences between “row_number()”, “rank()” and “dense_rank()”?

716


What are the restraints imposed on the table design by a merge replication?

789


What is 2nf example?

728


What happens if null values are involved in comparison operations?

713


Will sql server 2005 allow you to reduce the size of a column?

702


How many triggers are possible per table?

806


What are various limitations of the views?

792