PDC_REPORT_CreazioneDB/sql/Collaudo bfdskrepsei02c/procedure/dbo_sp_getTVElements_byParentID.sql
2025-06-26 18:47:11 +02:00

30 lines
700 B
Transact-SQL

CREATE PROCEDURE [dbo].[sp_getTVElements_byParentID]
@pID as int,
@idReport as int
AS
BEGIN
SET NOCOUNT ON;
SELECT [IdSezione]
,[Descrizione]
,[DtCancellazione]
,[IdSezionePadre]
,[DtCreazione]
,[Nome]
,[FlgSezione]
,[ClasseRealizzazione]
,[IdReport]
,[TpSezione]
,[Utente]
,[Ordine]
,[TpInclusione]
,[ClasseVisualizzazione]
,[NomeControlloGruppo]
,[IsDefault]
,[IsMandatory]
,[internalSectionCode]
,[IsBold]
,(select count(*) FROM [dbo].[Sezione] WHERE [IdSezionePadre]=sc.[IdSezione]) childnodecount
FROM [dbo].[Sezione] sc
WHERE [IdSezionePadre]=@pID and IdReport=@idReport
ORDER BY [Ordine]
END