File: OnUpdateTrigger.sql

package info (click to toggle)
indigo 1.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 48,936 kB
  • sloc: ansic: 332,816; cpp: 169,470; python: 20,033; java: 13,701; cs: 9,979; asm: 8,475; sql: 6,743; xml: 6,354; javascript: 1,245; sh: 555; php: 506; makefile: 54
file content (24 lines) | stat: -rw-r--r-- 588 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
CREATE TRIGGER {0}
	ON {1}
	FOR UPDATE
AS
	IF UPDATE({2}) 
	BEGIN 
		RAISERROR ('{2} column cannot be changed after Bingo index has been created.', 16, 1);
		ROLLBACK TRANSACTION
	END
	
	IF NOT UPDATE({3}) 
	BEGIN 
		RETURN 
	END
	
	IF OBJECT_ID('tempdb..##bingotmptbl_{5}_{6}') IS NOT NULL
	BEGIN
		DROP TABLE ##bingotmptbl_{5}_{6}
	END
	select {2}, {3} into ##bingotmptbl_{5}_{6} from inserted 

	exec {4}._OnDeleteRecordTrigger {5}, {6}, '##bingotmptbl_{5}_{6}'
	exec {4}._OnInsertRecordTrigger {5}, {6}, '##bingotmptbl_{5}_{6}'
	DROP TABLE ##bingotmptbl_{5}_{6}