I am trying to create a unique constraint across multiple tables. I have found similar questions answered here but they don\'t quite capture the spirit of what I am trying
One thought might be to combine the three tables:
CREATE TABLE t_Generic(
[AppName] [nvarchar](20) NOT NULL,
[ItemName] [nvarchar](32) NOT NULL,
[Type] [nvarchar](32) NOT NULL,
[AnalogValue] [Float] NULL,
[DiscreteValue] [bit] NULL,
[MessageValue] [nvarchar](256) NULL,
CONSTRAINT [uc_t_Generic] UNIQUE(AppName, ItemName)
)
Your application logic would have to enforce that only one value was populated, and you could use a Type field to keep track of what type that record is.