UPDATE TBDD_MODULES SET PRODUCT_VERSION = '2.4.7.1' where NAME = 'Record-Organizer' 
GO
ALTER TABLE TBDD_USER_LOGIN_OUT
 ADD CONNECTION_STRING VARCHAR(500) NOT NULL DEFAULT ''
GO
ALTER TABLE TBDD_USER_MODULE_LOG_IN
 ADD CONNECTION_STRING VARCHAR(500) NOT NULL DEFAULT ''
GO
ALTER TRIGGER [dbo].[TBDD_USER_MODULE_LOG_IN_AFT_INS] ON [dbo].[TBDD_USER_MODULE_LOG_IN]
WITH EXECUTE AS CALLER
FOR INSERT
AS
BEGIN TRY
	DECLARE 
		@USER_ID		INTEGER,
		@MODULE			VARCHAR(50),
		@CLIENT_ID		INTEGER,
		@VERSION_CLIENT	VARCHAR(30),
		@MACHINE_NAME	VARCHAR(50),
		@CONNECTION_STRING	VARCHAR(500)
	SELECT
  		@USER_ID = USER_ID,
		@MODULE = MODULE,
		@CLIENT_ID = CLIENT_ID,
		@VERSION_CLIENT = VERSION_CLIENT,
		@MACHINE_NAME = MACHINE_NAME,
		@CONNECTION_STRING = CONNECTION_STRING
	FROM INSERTED
	
	IF @VERSION_CLIENT IS NULL
		SET @VERSION_CLIENT = '1.0.0.0'
	INSERT INTO TBDD_USER_LOGIN_OUT (MODULE,USER_ID,CLIENT_ID,VERSION_CLIENT,MACHINE_NAME,CONNECTION_STRING) VALUES (@MODULE,@USER_ID,@CLIENT_ID,@VERSION_CLIENT,@MACHINE_NAME,@CONNECTION_STRING)
END TRY
BEGIN CATCH   
	PRINT 'FEHLER IN TRIGGER: ' + CONVERT(VARCHAR(30),ERROR_PROCEDURE()) + ' - ZEILE: ' + CONVERT(VARCHAR(10),ERROR_LINE())
	+ ' - FEHLER-MESSAGE: ' 
    + CONVERT(VARCHAR(500),ERROR_MESSAGE())
END CATCH
GO