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/42/42e708188cca82c2341c68335de...

37 lines
2.3 KiB

USE [Vertragsverwaltung_20160404]
GO
/****** Object: StoredProcedure [dbo].[sp_get_applstruktur_up] Script Date: 02.12.2016 09:08:53 ******/
DROP PROCEDURE [dbo].[sp_get_applstruktur_up]
GO
/****** Object: StoredProcedure [dbo].[sp_get_applstruktur_up] Script Date: 02.12.2016 09:08:55 ******/
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
CREATE proc [dbo].[sp_get_applstruktur_up]
@Root int,
@mitarbeiternr int
AS
BEGIN
print 'hallo'
SET NOCOUNT ON
declare @applid int, @bezeichnung varchar(50), @nr int, @parent int, @seclevel int, @aktiv bit
select @bezeichnung=bezeichnung, @nr=applikationnr, @parent=parentid, @seclevel=securitylevelnr, @aktiv=aktiv from applikation
where applikationnr=@root
insert into #tmpd (applikationsnr, bezeichnung, parentid, securitylevelnr, aktiv) values (@nr, @bezeichnung, @parent,@seclevel,@aktiv)
set @applid=(select parentid from applikation where applikationnr=@nr)
while @applid is not null begin
exec dbo.sp_get_applstruktur_up @applid, 1
set @applid=(select parentid from dbo.applikation
where applikationnr = @nr and parentid>@applid)
end
end
GO