Files
DP44/DataPRO_sql/dbo.sp_TemplateChannelsGet.StoredProcedure.sql

99 lines
4.1 KiB
MySQL
Raw Normal View History

2026-04-17 14:55:32 -04:00
<EFBFBD><EFBFBD>IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_TemplateChannelsGet]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[sp_TemplateChannelsGet]
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_TemplateChannelsGet]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[sp_TemplateChannelsGet] AS'
END
GO
ALTER PROCEDURE [dbo].[sp_TemplateChannelsGet]
@TemplateName nvarchar(50) = null
AS
BEGIN
SET NOCOUNT ON;
declare @TemplateId int
set @TemplateId = dbo.foo_IdGetTemplate(@TemplateName)
SELECT tc.[TemplateChannelId]
,tc.[TestObjectNumber]
,tc.[NameOfTheChannel]
,tc.[LaboratoryChannelCode]
,tc.[CustomerChannelCode]
,tc.[Comments1]
,tc.[Location]
,tc.[Dimension]
,tc.[Direction]
,tc.[ChannelFrequencyClass]
,tc.[Unit]
,tc.[ReferenceSystem]
,tc.[TransducerType]
,tc.[TransducerId]
,tc.[PreFilterType]
,tc.[CutOffFrequency]
,tc.[ChannelAmplitudeClass]
,tc.[ReferenceChannel]
,tc.[ReferenceChannelName]
,tc.[DataSource]
,tc.[DataStatus]
,tc.[SamplingInterval]
,tc.[BitResolution]
,tc.[TimeOfFirstSample]
,tc.[NumberOfSamples]
,tc.[OffsetPostTest]
,tc.[TransducerNaturalFrequency]
,tc.[TransducerDampingRatio]
,tc.[Comments]
,tc.[FirstGlobalMaximumValue]
,tc.[TimeOfMaximumValue]
,tc.[FirstGlobalMinimumValue]
,tc.[TimeOfMinimumValue]
,tc.[StartOffsetInterval]
,tc.[EndOffsetInterval]
,tc.[Required]
,tc.[LocalOnly]
,tc.[MMEChannelId]
,tc.[MMEChannelType]
,t.TemplateName as TemplateName
,tc.[DisplayOrder]
from [dbo].[TemplateChannels] tc
inner join [dbo].[TestObjectTemplates] t on t.TemplateId = tc.TemplateId
where @TemplateName is null or tc.TemplateId = @TemplateId
order by tc.TemplateId, tc.[DisplayOrder]
END
GO