CONTOH trigger nya
CREATE TRIGGER [TotalPenjualan_Baju]
ON [dbo].[Table_penjualan_baju]
AFTER INSERT,DELETE,UPDATE
AS
BEGIN
SET NOCOUNT ON;
DECLARE @kode int
DECLARE @jual int
SELECT @kode = kode_barang, @jual = sum(terjual) FROM Table_penjualan_baju Group by Kode_barang
if @jual is not null
UPDATE Table_barang SET Total_penjualan = @jual WHERE kode_barang = @kode
END
=======================================
http://ilmukomputer.org/wp-content/uploads/2014/05/Rhifky-Belajar-Membuat-Trigger-Dalam-Database-SQL-Server-2008.pdf
=======================================
https://richmadiyanti25.wordpress.com/2013/04/25/penggunaan-trigger-dalam-sql/
0 Response to "trigger sederhana"
Posting Komentar