73 lines
2.9 KiB
Plaintext
73 lines
2.9 KiB
Plaintext
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_SensorCalibrationsZeroMethodUpdate]') AND type in (N'P', N'PC'))
|
|
DROP PROCEDURE [dbo].[sp_SensorCalibrationsZeroMethodUpdate]
|
|
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_SensorCalibrationsZeroMethodUpdate]') AND type in (N'P', N'PC'))
|
|
BEGIN
|
|
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[sp_SensorCalibrationsZeroMethodUpdate] AS'
|
|
END
|
|
GO
|
|
ALTER PROCEDURE [dbo].[sp_SensorCalibrationsZeroMethodUpdate]
|
|
@ZeroMethod nvarchar(255) = null
|
|
,@SensorSerialNumber nvarchar(50) = null
|
|
,@CalibrationDate datetime
|
|
,@ModifiedDate datetime
|
|
,@errorNumber int output
|
|
,@errorMessage nvarchar(250) output
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
if(@SensorSerialNumber is null)
|
|
begin
|
|
set @errorNumber = 15600
|
|
set @errorMessage = 'An invalid parameter or option was specified for procedure'
|
|
end
|
|
else
|
|
begin
|
|
declare @SensorId int
|
|
set @SensorId = dbo.foo_IdGetSensor(@SensorSerialNumber)
|
|
|
|
UPDATE [dbo].[SensorCalibrations]
|
|
SET [ZeroMethod] = @ZeroMethod
|
|
WHERE [SensorId] = @SensorId and CalibrationDate = @CalibrationDate and [ModifyDate] = @ModifiedDate
|
|
|
|
if(@@error!=0)
|
|
begin
|
|
set @errorNumber = error_number()
|
|
set @errorMessage = error_message()
|
|
end
|
|
end
|
|
END
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|