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.
37 lines
2.0 KiB
37 lines
2.0 KiB
USE [Vertragsverwaltung_20160404]
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragselement_Parent_Struktur] Script Date: 02.12.2016 09:08:53 ******/
|
|
DROP PROCEDURE [dbo].[sp_vertragselement_Parent_Struktur]
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragselement_Parent_Struktur] Script Date: 02.12.2016 09:08:55 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE proc [dbo].[sp_vertragselement_Parent_Struktur]
|
|
@vertragspartnernr int,
|
|
@mitarbeiternr int
|
|
as
|
|
|
|
CREATE TABLE #tmpd(
|
|
[vertragselementnr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] null,
|
|
[aktiv] [bit] null,
|
|
|
|
) ON [DEFAULT]
|
|
|
|
insert #tmpd (vertragselementnr, bezeichnung, parentid, aktiv) values(0,'Root',null,1)
|
|
|
|
insert #tmpd select vertragselementnr, bezeichnung, parentid, aktiv from vertragselement
|
|
where vertragselement.vertragspartnernr=@vertragspartnernr
|
|
|
|
select * from #tmpd order by parentid, bezeichnung
|
|
drop table #tmpd
|
|
return
|
|
|
|
|
|
|
|
GO
|