[FieldName] type CONSTRAINT [constraint_name] UNIQUE
Example:
CREATE TABLE [Clients]
(
ClientID int NOT NULL IDENTITY(1,1) CONSTRAINT [PK_Clients] PRIMARY KEY,
ServiceCode varchar(50) NOT NULL CONSTRAINT [UQ_Clients_ServiceCode] UNIQUE
...
)
Example 2:
CREATE TABLE [Clients]
(
ClientID int NOT NULL IDENTITY(1,1) CONSTRAINT [PK_Clients] PRIMARY KEY,
ServiceCode varchar(50) NOT NULL,
CONSTRAINT [UN_Clients_Unique] UNIQUE (ClientID, ServiceCode)
...
)
No comments:
Post a Comment