USE [Vertragsverwaltung_20160404] GO /****** Object: StoredProcedure [dbo].[sp_get_struktur_oe] Script Date: 02.12.2016 09:08:53 ******/ DROP PROCEDURE [dbo].[sp_get_struktur_oe] GO /****** Object: StoredProcedure [dbo].[sp_get_struktur_oe] Script Date: 02.12.2016 09:08:55 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: -- Create date: -- Description: -- ============================================= CREATE PROCEDURE [dbo].[sp_get_struktur_oe] @per DATETIME AS BEGIN SELECT oenr AS id, parentid, bezeichnung, 0 AS imageindex, beschreibung AS ErweiterteSuche, sortierung AS Sort into #tmp2 FROM dbo.OE where aktiv=1 INSERT #tmp2 ( id, parentid, bezeichnung, imageindex, ErweiterteSuche, sort ) VALUES ( '0', NULL, 'Root', 0, ' ',1 ) SELECT * FROM #tmp2 ORDER BY parentid,sort, Bezeichnung DROP TABLE #tmp2 return END GO