Hi All, I'd like to run the following script...
Whenever the Shipped field on a record in the table wspikpak is changed from N to Y. I figured the best way to do this is through a trigger but I've never set one up before and was hoping someone here could give me a hand. Thanks in advance!
Code:
CREATE TABLE tbl
(Ord_no Char(8), shipment Char(30))
insert into tbl SELECT DISTINCT Ord_no AS Ord_no, Shipment AS Shipment from wspikpak where shipped='Y' AND (DATEDIFF([day], ship_dt, GETDATE()) = 0)
update o set O.user_def_fld_5=T.shipment
from tbl T JOIN oeordhdr_sql O
on T.ord_no =O.ord_no
where T.ord_no=O.ord_no
drop table tbl
Whenever the Shipped field on a record in the table wspikpak is changed from N to Y. I figured the best way to do this is through a trigger but I've never set one up before and was hoping someone here could give me a hand. Thanks in advance!