You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ITSM/.svn/pristine/b3/b34c47d5b1971974a8e1f2b669c...

49 lines
5.4 KiB

USE [Vertragsverwaltung_20160404]
GO
/****** Object: StoredProcedure [dbo].[sp_get_vertragselement_applikation] Script Date: 02.12.2016 09:08:53 ******/
DROP PROCEDURE [dbo].[sp_get_vertragselement_applikation]
GO
/****** Object: StoredProcedure [dbo].[sp_get_vertragselement_applikation] Script Date: 02.12.2016 09:08:55 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
CREATE PROCEDURE [dbo].[sp_get_vertragselement_applikation]
@KeyValue int,
@mitarbeiternr int
AS
SELECT dbo.VertragselementApplikation.VertragselementApplikationnr,
dbo.VertragselementApplikation.Vertragselementnr,
dbo.VertragselementApplikation.Applikationnr,
dbo.Vertragselement.Bezeichnung as Vertragselement, dbo.Applikation.Bezeichnung AS Applikation,
dbo.VertragselementApplikation.Bemerkung, dbo.VertragselementApplikation.Aktiv,
dbo.VertragselementApplikation.Erstellt_am, dbo.VertragselementApplikation.Mutiert_am,
dbo.VertragselementApplikation.Mutierer
into #tmp1
FROM dbo.VertragselementApplikation INNER JOIN
dbo.Vertragselement ON dbo.VertragselementApplikation.Vertragselementnr = dbo.Vertragselement.Vertragselementnr INNER JOIN
dbo.Applikation ON dbo.VertragselementApplikation.Applikationnr = dbo.Applikation.ApplikationNr
where dbo.vertragselementapplikation.applikationnr=@keyvalue and
dbo.vertragselement.SecurityLevelnrin (select SecurityLevelNr from dbo.Get_SecurityLevelTab(@mitarbeiternr)) and
dbo.vertragselementapplikation.aktiv=1
order by dbo.applikation.bezeichnung
insert into #tmp1
SELECT - 99 AS vertragselementapplikationsnr, dbo.Vertragselement.Vertragselementnr, dbo.Applikation.ApplikationNr, dbo.Vertragselement.Bezeichnung AS Vertragselement,
dbo.Applikation.Bezeichnung AS Applikation, 'Lizenzelemnt' AS bemekrung, 1 AS aktiv, dbo.Vertragselement.Erstellt_am, dbo.Vertragselement.Mutiert_am,
dbo.Vertragselement.Mutierer
FROM dbo.Vertragselement INNER JOIN
dbo.Applikation ON dbo.Vertragselement.ApplikationNr = dbo.Applikation.ApplikationNr INNER JOIN
dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr
WHERE (dbo.Vertragselement.Aktiv = 1) AND (dbo.Vertragstyp.AlsLizenz = 1) and
dbo.vertragselement.SecurityLevelnrin (select SecurityLevelNr from dbo.Get_SecurityLevelTab(@mitarbeiternr))
and dbo.applikation.applikationnr=@keyvalue
-- Get the Error Code for the statement just executed.
select distinct * from #tmp1 where VertragselementApplikationnr >-1
drop table #tmp1
GO