USE [Vertragsverwaltung_20160404] GO /****** Object: StoredProcedure [dbo].[sp_get_dokumente] Script Date: 02.12.2016 09:08:53 ******/ DROP PROCEDURE [dbo].[sp_get_dokumente] GO /****** Object: StoredProcedure [dbo].[sp_get_dokumente] Script Date: 02.12.2016 09:08:55 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO Create PROCEDURE [dbo].[sp_get_dokumente] --------------------------------------------------------------------------------- -- Stored procedure that will select all rows from the table 'Kuendigungsfrist' -- Returns: @iErrorCode int --------------------------------------------------------------------------------- @keyvalue int, @doktype int, @mitarbeiternr int AS SELECT 0 as DokIcon, dbo.Dokument.DokumentNr, dbo.Dokument.KeyValue, dbo.Dokumenttyp.Bezeichnung as Dokumenttyp, dbo.Dokument.Bezeichnung AS Bezeichnung, dbo.Dokument.Beschreibung, dbo.Dokument.Filename, dbo.Dokument.OriginalFilename_incl_Path, dbo.Dokument.Version, dbo.Dokument.VersionsNr, dbo.Dokument.Versionsdatum, dbo.Dokument.Erstellt_am, dbo.Dokument.Mutiert_am, dbo.Dokument.Mutierer, dbo.Dokument.Aktiv, dbo.Dokument.SecurityLevelNr FROM dbo.Dokument INNER JOIN dbo.Dokumenttyp ON dbo.Dokument.DokumenttypNr = dbo.Dokumenttyp.Dokumenttypnr where dbo.dokument.SecurityLevelnrin (select SecurityLevelNr from dbo.Get_SecurityLevelTab(@mitarbeiternr)) and Keyvalue = @keyvalue and doktype=@doktype order by dbo.dokument.erstellt_am desc RETURN GO