Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Creating After Insert Trigger in sql server 2008

Author  Topic 

jackal
Starting Member

2 Posts

Posted - 2014-02-21 : 05:58:21
Hi my name is vishal. I was wondering how to create After insert trigger in sql server 2008. I have tables
table1:name:PurchaseOrder_master

Column Name DataType
agn(primary key not null) Int
PO_NO varchar(50)
supplier_id bigint
PO_Date date
terms int
TAX bigint
row_upd_date datetime
user_id int
technician_id bigint

table2:name:PurchaseOrder_trans

Column Name DataType
PO_id bigint
PO_NO varchar(50)
qty bigint
price float
status bit
row_upd_date datetime
user_id int

table3:name:Inward

Column Name DataType
mfr_ref_number varchar(50)
no_of_bundle int
supplier_id int
DC_date date
INV_date date
row_upd_date datetime
courier_name varchar(50)
inward_type varchar(50)
user_id int
deleted_status bit
deleted_date datetime
DC_NO varchar(50)
closed_status bit
closed_date datetime
store_no bigint
to_dept varchar(50)
agn(int primary key not null) Int
PO_NO varchar(50)

table4:name:Stock_Register

Column Name DataType
in_out_type int
technician_id bigint
user_id int
row_upd_date datetime
status bit
deleted_date datetime
deleted_status bit
item_id bigint
qty_debit float
qty_credit float
int_out_id bigint
store_no bigint
ref_id bigint

Now what i want is when i insert values in table Inward and after insertion of values in Inward table i want to insert values into tables(PurchaseOrder_master,PurchaseOrder_trans and Stock_Register) automatically using AfterInsert Trigger in Sql server 2008? Is it possible i can add common rows to each table if needed for the process. Can anyone tell me how to write AfterInsert Trigger for these tables ? Can anyone help me please.Any help or guidance in writing AfterInsert trigger would be greatly appreciated.


vishal77
   

- Advertisement -