ALTER TABLE Messages.Topic   ADD CONSTRAINT CHKTopic_Name_NotEmpty       CHECK (LEN(RTRIM(Name)) > 0);ALTER TABLE Messages.MessageTopic   ADD CONSTRAINT CHKMessageTopic_UserDefinedTopicName_NotEmpty       CHECK (LEN(RTRIM(UserDefinedTopicName)) > 0);

The other domain we specifically mentioned was for the UserHandle, as repeated in Table 6-9.

Table 6-9. Domain: UserHandle

Property

Setting

Name

UserHandle

Optional

No

Datatype

Basic character set, maximum of 20 characters

Value Limitations

Must be 5–20 simple alphanumeric characters and start with a letter

Default Value

n/a

To implement this domain, things get a bit more interesting:

ALTER TABLE Attendees.MessagingUser  ADD CONSTRAINT CHKMessagingUser_UserHandle_LengthAndStart     CHECK (LEN(Rtrim(UserHandle)) ...

Get Pro SQL Server Relational Database Design and Implementation, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.