Unique constraint on multiple columns

WE can make it with Table Query

CREATE TABLE [dbo].[user](
    [userID] [int] IDENTITY(1,1) NOT NULL,
    [fcode] [int] NULL,
    [scode] [int] NULL,
    [dcode] [int] NULL,
    [name] [nvarchar](50) NULL,
    [address] [nvarchar](50) NULL,
 CONSTRAINT [PK_user_1] PRIMARY KEY CLUSTERED 
(
    [userID] ASC
),
CONSTRAINT [UQ_codes] UNIQUE NONCLUSTERED
(
    [fcode], [scode], [dcode]
)
) ON [PRIMARY]
OR :

ALTER TABLE dbo.User
  ADD CONSTRAINT ucCodes UNIQUE (focde, scode, dcode)

Comments

Popular posts from this blog

C# Crop white space from around the image

Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=xx.0.0.0, Culture=neutral, PublicKeyToken='xxx' or one of its dependencies.

The specified version string contains wildcards, which are not compatible with determinism.