kspiderman
IS-IT--Management
below is my code to copy from invoices(header) to ca_temp_invoices.
then trigger should be work to copy x_invoic(detail) to ca_temp_x_invoic.
if I copy 4 invoice in to temp_invoices, then I should have all 4 x_invoic(deatil) information should be copyed in to ca_temp_x_invoic but only copy 1 of last inovoice number detail is copyed in to ca_temp_x_invoic. "CAN SOMEBODY HELP". I been reading professional SQL Server 2000 Programming book for couple days to find but couldn't.
"My Trigger begins"
CREATE Trigger CA_Temp_X_inv_Ins_Del on dbo.ca_temp_invoices for
insert as
Declare @status tinyint
Declare @doc_no varchar (15)
select @status=inserted.status, @doc_no=inserted.doc_no from inserted
if @@rowcount = 0 return -- no rows affected, exit immediately
if @doc_no = null return
BEGIN
Begin Tran
insert ca_temp_x_invoic
select * from x_invoic where status=@status and order_no=@doc_no and desc_type=1
--exec CA_Insert_T_inv @status, @doc_no
COMMIT
END
then trigger should be work to copy x_invoic(detail) to ca_temp_x_invoic.
if I copy 4 invoice in to temp_invoices, then I should have all 4 x_invoic(deatil) information should be copyed in to ca_temp_x_invoic but only copy 1 of last inovoice number detail is copyed in to ca_temp_x_invoic. "CAN SOMEBODY HELP". I been reading professional SQL Server 2000 Programming book for couple days to find but couldn't.
"My Trigger begins"
CREATE Trigger CA_Temp_X_inv_Ins_Del on dbo.ca_temp_invoices for
insert as
Declare @status tinyint
Declare @doc_no varchar (15)
select @status=inserted.status, @doc_no=inserted.doc_no from inserted
if @@rowcount = 0 return -- no rows affected, exit immediately
if @doc_no = null return
BEGIN
Begin Tran
insert ca_temp_x_invoic
select * from x_invoic where status=@status and order_no=@doc_no and desc_type=1
--exec CA_Insert_T_inv @status, @doc_no
COMMIT
END