UPDATE TBPMO_KONFIGURATION SET SQL_RECORD_SQL1 = 'SELECT T.GUID AS [Record-ID],T.FORM_ID AS [Form-ID],' where GUID = 1

DECLARE	@FORM_ID		INT
		
DECLARE	c_FORM	CURSOR FOR SELECT GUID FROM TBPMO_FORM 
OPEN c_FORM 
    FETCH NEXT FROM c_FORM INTO @FORM_ID
    
	WHILE @@FETCH_STATUS = 0
		BEGIN
			EXEC PRPMO_CREATE_SQL @FORM_ID
			
			FETCH NEXT FROM c_FORM INTO @FORM_ID
		END

	CLOSE c_FORM
    DEALLOCATE c_FORM


GO

EXEC	[dbo].[PRPMO_CREATE_TEMP_VIEWS]