Hi,
In this article we will see example of logical table or magic table when we insert data in sql table.
In this article we will see example of logical table or magic table when we insert data in sql table.
Example::
Suppose we have emp_info . Now We need to create two triggers to see data with
in logical tables Inserted and Deleted.
Suppose we have emp_info . Now We need to create two triggers to see data with
in logical tables Inserted and Deleted.
Step 1::Create Table
create table emp_info (empno int,ename varchar(100),manage_id int)
Step 2 :: CREATE TRIGGER on emp_info
CREATE TRIGGER trg_Emp_Ins
ON emp_info
FOR INSERT
AS
begin
SELECT * FROM INSERTED -- show data in Inserted logical table
SELECT * FROM DELETED -- show data in Deleted logical table
end
Step 3::Now insert a new record in emp_info table to see data with in Inserted logical table.
INSERT INTO emp_info(empno, ename, manage_id) VALUES(3,'Sandip G',3)
SELECT * FROM emp_info
I hope You got something useful in this article.I would like to have feedback from my blog readers.
Your valuable feedback, question, or comments about this article are always welcome.
Other Popular Posts ::
send sql table data via email using store procedure
How to use Store Procedure inside a store procedure
SET ANSI_NULLS in sql server
SET QUOTED_IDENTIFIER in sql
example of Cursor in sql server
basic of Cursor in sql.
delete duplicate records in sql server
select duplicate records in sql server
update duplicate records in sql server
comman table expression(CTE) in sql server
Split Funtions in sql server
Sql queries for sql server
Trigger on Update
Trigger on insert
trigger on delete
basic of trigger
insert into view with multiple tables
Insert into View in sql server
Interview queries in sql server
How to use Store Procedure inside a store procedure
SET ANSI_NULLS in sql server
SET QUOTED_IDENTIFIER in sql
example of Cursor in sql server
basic of Cursor in sql.
delete duplicate records in sql server
select duplicate records in sql server
update duplicate records in sql server
comman table expression(CTE) in sql server
Split Funtions in sql server
Sql queries for sql server
Trigger on Update
Trigger on insert
trigger on delete
basic of trigger
insert into view with multiple tables
Insert into View in sql server
Interview queries in sql server
No comments:
Post a Comment
if you have any doubt any suggestions do comment