1 -- Description: <this trigger is used to track the every change of [stdb_stor_sku_assrtm_reltn>
2 -- =============================================
3 ALTER TRIGGER [dbo].[trigger_stdb_stor_sku_assrtm_reltn]
4 ON [dbo].[stdb_stor_sku_assrtm_reltn]
5 AFTER INSERT,DELETE,UPDATE
6 AS
7
8 BEGIN
9
10 insert into dbo.[stdb_stor_sku_assrtm_reltn_chg_adt]
11 (
12 [stor_id] ,
13 [sku_assrtm_type_id],
14 [last_upd_usr_id] ,
15 [last_upd_dtm] ,
16 [biz_pct] ,
17 chg_dtm ,
18 chg_type
19
20 )
21 select
22 [stor_id] ,
23 [sku_assrtm_type_id],
24 [last_upd_usr_id] ,
25 [last_upd_dtm] ,
26 [biz_pct] ,
27 getdate()
28 ,'Delete'
29 from
30 Deleted
31
32
33 insert into dbo.[stdb_stor_sku_assrtm_reltn_chg_adt]
34 (
35 [stor_id] ,
36 [sku_assrtm_type_id],
37 [last_upd_usr_id] ,
38 [last_upd_dtm] ,
39 [biz_pct] ,
40 chg_dtm ,
41 chg_type
42 )
43 select
44 [stor_id] ,
45 [sku_assrtm_type_id],
46 [last_upd_usr_id] ,
47 [last_upd_dtm] ,
48 [biz_pct] ,
49
50 getdate()
51 ,'Insert'
52 from
53 Inserted
54
55
56
57
58 END