﻿ALTER PROCEDURE [dbo].[sp_SensorsAnalogBridgeResistanceGet]
			 @sensorID			int				= null
			,@SerialNumber		nvarchar(50)	= null
			,@BridgeResistance  float			output
			,@errorNumber		int				output
			,@errorMessage		nvarchar(250)	output
AS
BEGIN
	set @errorNumber = 0; 	
	set @errorMessage = space(0);
	set @BridgeResistance = 0.0;
	begin try
		if(@SerialNumber is null)
		begin 
			set @errorMessage	= 'An invalid parameter or option was specified for procedure'
			set @errorNumber	= 15600
		end
		else
		begin
			select @BridgeResistance = B.[BridgeResistance] from [dbo].[SensorsAnalog] AS B INNER JOIN [dbo].[Sensors] as A ON B.SensorId = A.id WHERE A.SerialNumber =@SerialNumber AND A.SensorType=0;
		end
	end try
	begin catch
		set @errorMessage	= error_message()
		set @errorNumber	= error_number()
	end catch;
END
