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

Explain left outer join and right outer join?

555


Which language is supported by sql server?

553


in a table is b in column k (manikanta,sivananda,muralidhar) i want result like (mnikanta,sivnanda,murlidhar) please slove it

1051


If a table does not have a unique index, can a cursor be opened on it?

513


What is the chart in report?

111






How can you tell if a database object is invalid?

612


Which tcp/ip port does sql server run on? How can it be changed?

567


What is the sql case statement used for?

557


How to use copy and concatenate commands in SQL?

597


How many databases Microsoft SQL server provides?

608


What is a fill factor?

618


What do you mean by an execution plan? Why is it used? How would you view it?

527


List the different types of collation sensitivities in sql server?

522


What are the different types of subquery?

612


How will you hide an attribute? : sql server analysis services, ssas

519