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

41 lines
3.8 KiB
Transact-SQL
Raw 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.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_DASChannels_DAS]') AND parent_object_id = OBJECT_ID(N'[dbo].[DASChannels]'))
ALTER TABLE [dbo].[DASChannels] DROP CONSTRAINT [FK_DASChannels_DAS]
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DASChannels]') AND type in (N'U'))
DROP TABLE [dbo].[DASChannels]
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].[DASChannels]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[DASChannels](
[DASChannelId] [int] IDENTITY(1,1) NOT NULL,
[DASId] [int] NULL CONSTRAINT [DF_DASChannels_DASId] DEFAULT ((0)),
[ChannelIdx] [int] NULL,
[SupportedBridges] [int] NULL,
[SupportedExcitations] [int] NULL,
[DASDisplayOrder] [int] NULL,
[LocalOnly] [bit] NULL,
[SupportedDigitalInputModes] [int] NULL,
[SupportedSquibFireModes] [int] NULL,
[SupportedDigitalOutputModes] [int] NULL,
[ModuleSerialNumber] [nvarchar](16) NULL,
[SettingId] [int] NOT NULL CONSTRAINT [DF_DASChannels_SettingId] DEFAULT ((0)),
[ModuleArrayIndex] [int] NULL,
CONSTRAINT [PK_DASChannels] PRIMARY KEY CLUSTERED
(
[DASChannelId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_DASChannels_DAS]') AND parent_object_id = OBJECT_ID(N'[dbo].[DASChannels]'))
ALTER TABLE [dbo].[DASChannels] WITH NOCHECK ADD CONSTRAINT [FK_DASChannels_DAS] FOREIGN KEY([DASId])
REFERENCES [dbo].[DAS] ([DASId])
GO
IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_DASChannels_DAS]') AND parent_object_id = OBJECT_ID(N'[dbo].[DASChannels]'))
ALTER TABLE [dbo].[DASChannels] CHECK CONSTRAINT [FK_DASChannels_DAS]
GO