USE [Vertragsverwaltung_20160404] GO /****** Object: StoredProcedure [dbo].[pr_Person_SelectAll_Bottomtable] Script Date: 02.12.2016 09:08:54 ******/ DROP PROCEDURE [dbo].[pr_Person_SelectAll_Bottomtable] GO /****** Object: StoredProcedure [dbo].[pr_Person_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 'Person' -- Returns: @iErrorCode int --------------------------------------------------------------------------------- Create PROCEDURE [dbo].[pr_Person_SelectAll_Bottomtable] @iErrorCode int OUTPUT, @Fokus int, @KeyValue int, @mitarbeiternr int AS SET NOCOUNT ON -- SELECT all rows from the table. SELECT dbo.Person.PersonNr, dbo.Person.Vertragspartnernr, dbo.Person.Name, dbo.Person.Vorname, dbo.Person.Strasse, dbo.Person.Postfach, dbo.Person.Plz, dbo.Person.Ort, dbo.Person.Telefon, dbo.Person.Telefax, dbo.Person.EMail, dbo.Person.Internet, dbo.Person.Bemerkung, dbo.Person.Aktiv, dbo.Person.Erstellt_am, dbo.Person.Mutiert_am, dbo.Person.Mutierer, dbo.Person.MandantNr, dbo.Person.SecurityLevelNr, ISNULL(dbo.PersonFunktion.Bezeichnung, '') AS Funktion FROM dbo.Person LEFT OUTER JOIN dbo.PersonFunktion ON dbo.Person.PersonFunktionNr = dbo.PersonFunktion.PersonFunktionNr where dbo.Person.SecurityLevelnrin (select SecurityLevelNr from dbo.Get_SecurityLevelTab(@mitarbeiternr)) and vertragspartnernr = @keyvalue ORDER BY Name, vorname ASC -- Get the Error Code for the statement just executed. SELECT @iErrorCode=@@ERROR GO