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

Describe the functionalities that views support.

664


Define self join in sql server joins?

527


How do I completely remove sql server instance?

571


What are the different types of Indexes available in SQL Server?

524


What is data modeling and Reterminal integrity?

1494






Where do we use trace frag?

576


Name the different type of indexes in sql?

538


Is it possible to import data directly from t-sql commands without using sql server integration services? If so, what are the commands?

867


What are the different types of backups avaialabe in sql server 2005?

630


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

536


Explain the functionalities that views support?

697


How can we delete Duplicate row in table?

639


Do you know what is openxml in sql server?

615


tell me what is blocking and how would you troubleshoot it? : Sql server database administration

489


What do you understand by the denormalisation?

555