USE [Vertragsverwaltung_20160404] GO /****** Object: StoredProcedure [dbo].[pr_rolle_SecurityObject_SelectAll_Bottomtable] Script Date: 02.12.2016 09:08:54 ******/ DROP PROCEDURE [dbo].[pr_rolle_SecurityObject_SelectAll_Bottomtable] GO /****** Object: StoredProcedure [dbo].[pr_rolle_SecurityObject_SelectAll_Bottomtable] Script Date: 02.12.2016 09:08:54 ******/ SET ANSI_NULLS OFF GO SET QUOTED_IDENTIFIER OFF GO --------------------------------------------------------------------------------- -- Stored procedure that will select all rows from the table 'funktionsgruppe_rolle' -- Returns: @iErrorCode int --------------------------------------------------------------------------------- CREATE PROCEDURE [dbo].[pr_rolle_SecurityObject_SelectAll_Bottomtable] @iErrorCode int OUTPUT, @Fokus int, @KeyValue int AS SET NOCOUNT ON if @fokus = 1 begin SELECT dbo.Rolle_SecurityObject.rolle_securityobjectnr, dbo.Rolle_SecurityObject.rollenr, dbo.rolle.bezeichnung AS Rolle, dbo.Rolle_SecurityObject.securityobjectnr, dbo.SecurityObject.SecurityForm + '|' + dbo.SecurityObject.SecurityObject + '|' + dbo.SecurityObject.SecurityObjectItem AS SecurityObjectBez, dbo.Rolle_SecurityObject.readonly, dbo.Rolle_SecurityObject.invisible, dbo.Rolle_SecurityObject.aktiv, dbo.Rolle_SecurityObject.erstellt_am, dbo.Rolle_SecurityObject.mutiert_am, dbo.Rolle_SecurityObject.mutierer, dbo.Rolle_SecurityObject.mandantnr FROM dbo.rolle INNER JOIN dbo.Rolle_SecurityObject ON dbo.rolle.rollenr = dbo.Rolle_SecurityObject.rollenr INNER JOIN dbo.SecurityObject ON dbo.Rolle_SecurityObject.securityobjectnr = dbo.SecurityObject.SecurityObjectNr WHERE (dbo.Rolle_SecurityObject.rollenr = @keyvalue) ORDER BY dbo.Rolle_SecurityObject.rolle_securityobjectnr end else begin SELECT dbo.Rolle_SecurityObject.rolle_securityobjectnr, dbo.Rolle_SecurityObject.rollenr, dbo.rolle.bezeichnung AS Rolle, dbo.Rolle_SecurityObject.securityobjectnr, dbo.SecurityObject.SecurityForm + '|' + dbo.SecurityObject.SecurityObject + '|' + dbo.SecurityObject.SecurityObjectItem AS SecurityObject, dbo.Rolle_SecurityObject.readonly, dbo.Rolle_SecurityObject.invisible, dbo.Rolle_SecurityObject.aktiv, dbo.Rolle_SecurityObject.erstellt_am, dbo.Rolle_SecurityObject.mutiert_am, dbo.Rolle_SecurityObject.mutierer, dbo.Rolle_SecurityObject.mandantnr FROM dbo.rolle INNER JOIN dbo.Rolle_SecurityObject ON dbo.rolle.rollenr = dbo.Rolle_SecurityObject.rollenr INNER JOIN dbo.SecurityObject ON dbo.Rolle_SecurityObject.securityobjectnr = dbo.SecurityObject.SecurityObjectNr WHERE (dbo.Rolle_SecurityObject.SecurityObjectNr = @keyvalue) ORDER BY dbo.Rolle_SecurityObject.rolle_securityobjectnr end -- SELECT all rows from the table. SELECT @iErrorCode=@@ERROR GO