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

121 lines
5.4 KiB
Transact-SQL
Raw Permalink 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_DASUpdate]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[sp_DASUpdate]
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_DASUpdate]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[sp_DASUpdate] AS'
END
GO
ALTER PROCEDURE [dbo].[sp_DASUpdate]
@DASId int = 0
,@SerialNumber nvarchar(50) = null
,@Type int
,@MaxModules int
,@MaxMemory bigint
,@MaxSampleRate decimal(18,0)
,@MinSampleRate decimal(18,0)
,@FirmwareVersion nvarchar(50)
,@CalDate datetime
,@ProtocolVersion int
,@LastModified datetime
,@LastModifiedBy nvarchar(50)
,@Version int
,@LocalOnly bit
,@LastUsed datetime
,@LastUsedBy nvarchar(50)
,@Connection nvarchar(50)
,@Channels int
,@Position nvarchar(50)
,@ChannelTypes nvarchar(255)
,@Reprogramable bit
,@Reconfigurable bit
,@IsModule bit
,@PositionOnDistributor smallint
,@PositionOnChain smallint
,@Port smallint
,@ParentDAS nvarchar(50)
,@errorNumber int output
,@errorMessage nvarchar(250) output
AS
BEGIN
set @errorNumber = 0
set @errorMessage = space(0)
SET NOCOUNT ON;
if(@SerialNumber is null)
begin
set @errorNumber = 15600
set @errorMessage = 'An invalid parameter or option was specified for procedure'
end
else
begin
if(@DASId = 0)
begin
set @DASId = dbo.foo_IdGetDAS(@SerialNumber)
end
UPDATE [dbo].[DAS]
SET [Type] = @Type
,[MaxModules] = @MaxModules
,[MaxMemory] = @MaxMemory
,[MaxSampleRate] = @MaxSampleRate
,[MinSampleRate] = @MinSampleRate
,[FirmwareVersion] = @FirmwareVersion
,[CalDate] = @CalDate
,[ProtocolVersion] = @ProtocolVersion
,[LastModified] = @LastModified
,[LastModifiedBy] = @LastModifiedBy
,[Version] = @Version
,[LocalOnly] = @LocalOnly
,[LastUsed] = @LastUsed
,[LastUsedBy] = @LastUsedBy
,[Connection] = @Connection
,[Channels] = @Channels
,[Position] = @Position
,[ChannelTypes] = @ChannelTypes
,[Reprogramable] = @Reprogramable
,[Reconfigurable] = @Reconfigurable
,[IsModule] = @IsModule
,[PositionOnDistributor]= @PositionOnDistributor
,[PositionOnChain] = @PositionOnChain
,[Port] = @Port
,[ParentDAS] = @ParentDAS
WHERE [DASId] = @DASId
end
END
GO