151 lines
7.2 KiB
Plaintext
151 lines
7.2 KiB
Plaintext
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_SensorModelsInsert]') AND type in (N'P', N'PC'))
|
|
DROP PROCEDURE [dbo].[sp_SensorModelsInsert]
|
|
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_SensorModelsInsert]') AND type in (N'P', N'PC'))
|
|
BEGIN
|
|
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[sp_SensorModelsInsert] AS'
|
|
END
|
|
GO
|
|
ALTER PROCEDURE [dbo].[sp_SensorModelsInsert]
|
|
@Model nvarchar(50)
|
|
,@Manufacturer nvarchar(50)
|
|
,@UserPartNumber nvarchar(50)
|
|
,@Capacity float
|
|
,@OffsetToleranceLow float
|
|
,@OffsetToleranceHigh float
|
|
,@MeasurementUnit nvarchar(50)
|
|
,@Bridge smallint
|
|
,@Shunt smallint
|
|
,@BridgeResistance float
|
|
,@FilterClass nvarchar(50)
|
|
,@UniPolar bit
|
|
,@IgnoreRange bit
|
|
,@CouplingMode smallint
|
|
,@Version int
|
|
,@RangeLow float
|
|
,@RangeAve float
|
|
,@RangeHigh float
|
|
,@LastModified datetime
|
|
,@ModifiedBy nvarchar(50)
|
|
,@LocalOnly bit
|
|
,@NumberOfAxes smallint
|
|
,@CalInterval int
|
|
,@AxisNumber smallint
|
|
,@Polarity nvarchar(10)
|
|
,@Invert bit
|
|
,@CheckOffset bit
|
|
,@CalibrationRecord nvarchar(255)
|
|
,@ISOCode nvarchar(20)
|
|
,@SupportedExcitation nvarchar(255)
|
|
,@InitialEU float
|
|
,@new_id int output
|
|
,@errorNumber int output
|
|
,@errorMessage nvarchar(250) output
|
|
AS
|
|
BEGIN
|
|
|
|
set @errorNumber = 0
|
|
set @errorMessage = space(0)
|
|
INSERT INTO [dbo].[SensorModels]
|
|
([Model]
|
|
,[Manufacturer]
|
|
,[UserPartNumber]
|
|
,[Capacity]
|
|
,[OffsetToleranceLow]
|
|
,[OffsetToleranceHigh]
|
|
,[MeasurementUnit]
|
|
,[Bridge]
|
|
,[Shunt]
|
|
,[BridgeResistance]
|
|
,[FilterClass]
|
|
,[UniPolar]
|
|
,[IgnoreRange]
|
|
,[CouplingMode]
|
|
,[Version]
|
|
,[RangeLow]
|
|
,[RangeAve]
|
|
,[RangeHigh]
|
|
,[LastModified]
|
|
,[ModifiedBy]
|
|
,[LocalOnly]
|
|
,[NumberOfAxes]
|
|
,[CalInterval]
|
|
,[AxisNumber]
|
|
,[Polarity]
|
|
,[Invert]
|
|
,[CheckOffset]
|
|
,[CalibrationRecord]
|
|
,[ISOCode]
|
|
,[SupportedExcitation]
|
|
,[InitialEU])
|
|
VALUES
|
|
(@Model
|
|
,@Manufacturer
|
|
,@UserPartNumber
|
|
,@Capacity
|
|
,@OffsetToleranceLow
|
|
,@OffsetToleranceHigh
|
|
,@MeasurementUnit
|
|
,@Bridge
|
|
,@Shunt
|
|
,@BridgeResistance
|
|
,@FilterClass
|
|
,@UniPolar
|
|
,@IgnoreRange
|
|
,@CouplingMode
|
|
,@Version
|
|
,@RangeLow
|
|
,@RangeAve
|
|
,@RangeHigh
|
|
,@LastModified
|
|
,@ModifiedBy
|
|
,@LocalOnly
|
|
,@NumberOfAxes
|
|
,@CalInterval
|
|
,@AxisNumber
|
|
,@Polarity
|
|
,@Invert
|
|
,@CheckOffset
|
|
,@CalibrationRecord
|
|
,@ISOCode
|
|
,@SupportedExcitation
|
|
,@InitialEU)
|
|
|
|
set @new_id = scope_identity()
|
|
END
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|