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

150 lines
5.8 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_SensorsAnalogGetPaged]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[sp_SensorsAnalogGetPaged]
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_SensorsAnalogGetPaged]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[sp_SensorsAnalogGetPaged] AS'
END
GO
ALTER PROCEDURE [dbo].[sp_SensorsAnalogGetPaged]
@startIndex int = 0
,@maxRows int = 0
AS
BEGIN
SET NOCOUNT ON;
select [SerialNumber]
,[UserSerialNumber]
,[Model]
,[SensorModelId]
,[Manufacturer]
,[Status]
,[MeasurementUnit]
,[OffsetToleranceLow]
,[OffsetToleranceHigh]
,[Id]
,[Capacity]
,[Comment]
,[BridgeType]
,[BridgeLegMode]
,[Shunt]
,[Invert]
,[UserValue1]
,[UserValue2]
,[UserValue3]
,[FilterClass]
,[BridgeResistance]
,[IsoCode]
,[CheckOffset]
,[SupportedExcitation]
,[InitialEU]
,[CalInterval]
,[CalibrationSignal]
,[InternalShuntResistance]
,[ExternalShuntResistance]
,[UniPolar]
,[RangeLow]
,[RangeAve]
,[RangeHigh]
,[Created]
,[TimesUsed]
,[SensorCategory]
,[BypassFilter]
,[CouplingMode]
,[Version]
,[LastModified]
,[ModifiedBy]
,[LocalOnly]
,[AxisNumber]
,[NumberOfAxes]
,[UserTags]
,[DoNotUse]
,[Broken]
FROM
(SELECT
ROW_NUMBER() OVER (ORDER BY Id) AS RowNumber
,[SerialNumber]
,[UserSerialNumber]
,[Model]
,[SensorModelId]
,[Manufacturer]
,[Status]
,[MeasurementUnit]
,[OffsetToleranceLow]
,[OffsetToleranceHigh]
,[Id]
,[Capacity]
,[Comment]
,[BridgeType]
,[BridgeLegMode]
,[Shunt]
,[Invert]
,[UserValue1]
,[UserValue2]
,[UserValue3]
,[FilterClass]
,[BridgeResistance]
,[IsoCode]
,[CheckOffset]
,[SupportedExcitation]
,[InitialEU]
,[CalInterval]
,[CalibrationSignal]
,[InternalShuntResistance]
,[ExternalShuntResistance]
,[UniPolar]
,[RangeLow]
,[RangeAve]
,[RangeHigh]
,[Created]
,[TimesUsed]
,[SensorCategory]
,[BypassFilter]
,[CouplingMode]
,[Version]
,[LastModified]
,[ModifiedBy]
,[LocalOnly]
,[AxisNumber]
,[NumberOfAxes]
,isnull([UserTags], 0) as [UserTags]
,[DoNotUse]
,[Broken]
FROM [dbo].[SensorsAnalog]) as Sensors
WHERE RowNumber > @startIndex and RowNumber <= (@startIndex + @maxRows)
END
GO