I've got a table and i'm wanting to add a constraint so that a record must contain either a clientID or a userNumber but they can't both be empty.
for example
CREATE TABLE [dbo].[ClientIndex] (
[SequenceID] [int] IDENTITY (1, 1) NOT NULL ,
[ClientID] [ClientIDType] NOT NULL ,
[Surname] [String40] NULL ,
[SurnameSoundex] [SoundexType] NULL ,
[Firstname] [String40] NULL ,
[FirstnameSoundex] [SoundexType] NULL ,
[Title] [String10] NULL ,
[Gender] [Sex_type] NULL ,
[DateOfBirth] [datetime] NULL ,
[userNumber][integer] NULL,
CONSTRAINT [PK_Client] PRIMARY KEY CLUSTERED
(
[ClientID]
) WITH FILLFACTOR = 90 ON [PRIMARY]
) ON [PRIMARY]
I need there allways be either a ClientID or a userNumber , both cannot be NULL but they can both be populated if needed.
Any ideas how I go about writing this constraint.
for example
CREATE TABLE [dbo].[ClientIndex] (
[SequenceID] [int] IDENTITY (1, 1) NOT NULL ,
[ClientID] [ClientIDType] NOT NULL ,
[Surname] [String40] NULL ,
[SurnameSoundex] [SoundexType] NULL ,
[Firstname] [String40] NULL ,
[FirstnameSoundex] [SoundexType] NULL ,
[Title] [String10] NULL ,
[Gender] [Sex_type] NULL ,
[DateOfBirth] [datetime] NULL ,
[userNumber][integer] NULL,
CONSTRAINT [PK_Client] PRIMARY KEY CLUSTERED
(
[ClientID]
) WITH FILLFACTOR = 90 ON [PRIMARY]
) ON [PRIMARY]
I need there allways be either a ClientID or a userNumber , both cannot be NULL but they can both be populated if needed.
Any ideas how I go about writing this constraint.