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/05/05669e1ab4dbebcf44798a6f683...

42 lines
2.7 KiB

USE [Vertragsverwaltung_20160404]
GO
/****** Object: StoredProcedure [dbo].[sp_lc_get_Struktur] Script Date: 02.12.2016 09:08:53 ******/
DROP PROCEDURE [dbo].[sp_lc_get_Struktur]
GO
/****** Object: StoredProcedure [dbo].[sp_lc_get_Struktur] Script Date: 02.12.2016 09:08:55 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[sp_lc_get_Struktur]
AS
BEGIN
declare @tmp1 TABLE (id int, parentid int, bezeichnung varchar(255),imageindex INT,beschreibung VARCHAR(1024), copy INT, sort int)
SET NOCOUNT ON;
INSERT @tmp1 SELECT lc_produktnr AS id, lc_produktnr_parent AS parentid, bezeichnung, imageindex AS imageindex, ISNULL(Beschreibung,'') AS Beschreibung,0, ISNULL(sort,0) as sort FROM dbo.LC_Produkt WHERE aktiv=1 AND IstStruktur=1
INSERT @tmp1 ( id, parentid, bezeichnung, imageindex,beschreibung,copy,sort)
VALUES ( 0, NULL, 'Root', 1,'',0,-1)
UPDATE @tmp1 SET imageindex = imageindex + 0 WHERE id IN (SELECT lc_produktnr FROM lc_produkt WHERE IstStruktur=1)
SELECT *
FROM @tmp1
ORDER BY sort, bezeichnung
END
GO