Files
DP44/DataPRO_sql/dbo.sp_DBImportTestSetupGraphs.StoredProcedure.sql
2026-04-17 14:55:32 -04:00

78 lines
3.4 KiB
Transact-SQL
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_DBImportTestSetupGraphs]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[sp_DBImportTestSetupGraphs]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_DBImportTestSetupGraphs]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[sp_DBImportTestSetupGraphs] AS'
END
GO
ALTER PROCEDURE [dbo].[sp_DBImportTestSetupGraphs]
@TestSetupId int
,@Graphs xml
AS
BEGIN
insert into [dbo].[TestGraphs]
([TestSetupId]
,[GraphName]
,[GraphDescription]
,[Channels]
,[UseDomainMin]
,[DomainMin]
,[UseDomainMax]
,[DomainMax]
,[UseRangeMin]
,[RangeMin]
,[UseRangeMax]
,[RangeMax]
,[Thresholds]
,[LocalOnly])
select @TestSetupId
, t.x.value('(./GraphName)[1]', 'nvarchar(50)')
, t.x.value('(./GraphDescription)[1]', 'nvarchar(50)')
, t.x.value('(./Channels)[1]', 'nvarchar(2048)')
, t.x.value('(./UseDomainMin)[1]', 'bit')
, t.x.value('(./DomainMin)[1]', 'float')
, t.x.value('(./UseDomainMax)[1]', 'bit')
, t.x.value('(./DomainMax)[1]', 'float')
, t.x.value('(./UseRangeMin)[1]', 'bit')
, t.x.value('(./RangeMin)[1]', 'float')
, t.x.value('(./UseRangeMax)[1]', 'bit')
, t.x.value('(./RangeMax)[1]', 'float')
, t.x.value('(./Thresholds)[1]', 'nvarchar(2048)')
, t.x.value('(./LocalOnly)[1]', 'bit')
from @Graphs.nodes('/Graphs/Graph') t(x)
END
GO