CREATE TABLE TBPMO_CONTROL_HINT
(
	GUID			INTEGER			NOT NULL	IDENTITY(1,1),
	CONTROL_ID		INTEGER			NOT NULL,
	HINT_COMMENT	VARCHAR(500)	NOT NULL,
	LANGUAGE_CODE	VARCHAR(10)		NOT NULL	DEFAULT 'de-DE',
	ADDED_WHO		VARCHAR(50)		NOT NULL	DEFAULT 'DEFAULT',
	ADDED_WHEN		DATETIME 					DEFAULT GETDATE(),
	CHANGED_WHO     VARCHAR(50),
	CHANGED_WHEN	DATETIME,
	CONSTRAINT		PK_TBPMO_CONTROL_HINT						PRIMARY KEY (GUID),
	CONSTRAINT		UNIQUE_CONTROL_ID_LANGUAGE_CODE_CONTROL_ID	UNIQUE(CONTROL_ID,LANGUAGE_CODE),
	CONSTRAINT		FK_TBPMO_CONTROL_HINT_CONTROL_ID			FOREIGN KEY (CONTROL_ID)  REFERENCES  TBPMO_CONTROL (GUID),
)
GO

CREATE TRIGGER TBPMO_CONTROL_HINT_AFT_UPD ON TBPMO_CONTROL_HINT
FOR UPDATE
AS
	UPDATE TBPMO_CONTROL_HINT SET CHANGED_WHEN = GETDATE() FROM INSERTED WHERE TBPMO_CONTROL_HINT.GUID = INSERTED.GUID
GO