USE [Vertragsverwaltung_20160404] GO /****** Object: StoredProcedure [dbo].[pr_Vertragskontakt_SelectAll_bottomtable] Script Date: 02.12.2016 09:08:54 ******/ DROP PROCEDURE [dbo].[pr_Vertragskontakt_SelectAll_bottomtable] GO /****** Object: StoredProcedure [dbo].[pr_Vertragskontakt_SelectAll_bottomtable] Script Date: 02.12.2016 09:08:54 ******/ SET ANSI_NULLS OFF GO SET QUOTED_IDENTIFIER OFF GO CREATE proc [dbo].[pr_Vertragskontakt_SelectAll_bottomtable] --------------------------------------------------------------------------------- -- Stored procedure that will select all rows from the table 'Kuendigungsfrist' -- Returns: @iErrorCode int --------------------------------------------------------------------------------- @iErrorCode int OUTPUT, @Fokus int, @KeyValue int, @mitarbeiternr int AS SET NOCOUNT ON -- SELECT all rows from the table. SELECT dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Firma, dbo.Person.Name + ' ' + dbo.Person.Vorname AS Kontaktperson, dbo.Person.Telefon, dbo.Person.Telefax, dbo.Person.EMail, dbo.Kontakttyp.Bezeichnung AS Rolle, dbo.Vertragskontakt.Intern, dbo.Vertragskontakt.Bemerkung, dbo.Vertragskontakt.Aktiv, dbo.Vertragskontakt.Erstellt_am, dbo.Vertragskontakt.Mutiert_am, dbo.Vertragskontakt.Mutierer, dbo.Vertragskontakt.Mandantnr, dbo.Vertragskontakt.SecurityLevelNr, dbo.vertragskontakt.PersonNr, dbo.vertragskontakt.VertragskontaktNr FROM dbo.Vertragskontakt INNER JOIN dbo.Person ON dbo.Vertragskontakt.PersonNr = dbo.Person.PersonNr INNER JOIN dbo.Vertragspartner ON dbo.Person.Vertragspartnernr = dbo.Vertragspartner.VertragspartnerNr INNER JOIN dbo.Kontakttyp ON dbo.Vertragskontakt.KontakttypNr = dbo.Kontakttyp.KontakttypNr where dbo.Vertragskontakt.SecurityLevelnrin (select SecurityLevelNr from dbo.Get_SecurityLevelTab(@mitarbeiternr)) and vertragselementnr = @keyvalue ORDER BY [vertragskontaktnr] ASC -- Get the Error Code for the statement just executed. SELECT @iErrorCode=@@ERROR GO