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
How to create user defined functions with parameters?
How to execute the cursor queries with "open" statements?
How many categories of functions based their return modes?
How to connect php with different port numbers?
Explain what is it unwise to create wide clustered index keys?
Which language is supported by sql server?
What is difference between order by and group by?
What is cdc in sql server?
What do you understand by replication in sql server?
what is new philosophy for database devises for sql server 7.0? : Sql server database administration
Why you need indexing? Where that is stored and what you mean by schema object? For what purpose we are using view?
How to delete multiple rows with one delete statement in ms sql server?
What is SQL Azure Firewall?
What are the basic functions for master, msdb, model, tempdb and resource databases?
What is exporting and importing utility?