58 lines
1.6 KiB
Plaintext
58 lines
1.6 KiB
Plaintext
|
|
ALTER PROCEDURE [dbo].[sp_CalculatedChannelsInsert]
|
||
|
|
@Operation int
|
||
|
|
,@CalculatedChannelValueCode nvarchar(255)
|
||
|
|
,@InputChannelIds varbinary(max)
|
||
|
|
,@CFCForInputChannels nvarchar(255)
|
||
|
|
,@CFCForOutput nvarchar(255)
|
||
|
|
,@TestSetupName nvarchar(255)
|
||
|
|
,@CCName nvarchar(255)
|
||
|
|
,@ClipLength int
|
||
|
|
,@ViewInRealtime bit
|
||
|
|
,@new_id int OUTPUT
|
||
|
|
,@errorNumber int output
|
||
|
|
,@errorMessage nvarchar(250) output
|
||
|
|
AS
|
||
|
|
BEGIN
|
||
|
|
SET NOCOUNT ON;
|
||
|
|
set @errorNumber = 0
|
||
|
|
set @errorMessage = space(0)
|
||
|
|
|
||
|
|
if(@Operation is null or @TestSetupName is null)
|
||
|
|
begin
|
||
|
|
set @errorMessage = 'sp_CalculatedChannelsInsert: Error 1560 - An invalid parameter or option was specified for procedure'
|
||
|
|
set @errorNumber = 1560
|
||
|
|
end
|
||
|
|
else
|
||
|
|
begin
|
||
|
|
begin try
|
||
|
|
declare @TestSetupId int
|
||
|
|
set @TestSetupId = dbo.foo_IdGetTestSetup(@TestSetupName)
|
||
|
|
|
||
|
|
INSERT INTO [dbo].[CalculatedChannels]
|
||
|
|
([Operation]
|
||
|
|
,[CalculatedChannelValueCode]
|
||
|
|
,[InputChannelIds]
|
||
|
|
,[CFCForInputChannels]
|
||
|
|
,[CFCForOutput]
|
||
|
|
,[TestSetupId]
|
||
|
|
,[CCName]
|
||
|
|
,[ViewInRealtime]
|
||
|
|
,[ClipLength])
|
||
|
|
VALUES
|
||
|
|
(@Operation
|
||
|
|
,@CalculatedChannelValueCode
|
||
|
|
,@InputChannelIds
|
||
|
|
,@CFCForInputChannels
|
||
|
|
,@CFCForOutput
|
||
|
|
,@TestSetupId
|
||
|
|
,@CCName
|
||
|
|
,@ViewInRealtime
|
||
|
|
,@ClipLength)
|
||
|
|
set @new_id = scope_identity();
|
||
|
|
end try
|
||
|
|
begin catch
|
||
|
|
set @errorMessage = error_message()
|
||
|
|
set @errorNumber = error_number()
|
||
|
|
end catch
|
||
|
|
end
|
||
|
|
END
|