Unique constraint on multiple columns

前端 未结 4 1348
南笙
南笙 2020-11-28 01:05
CREATE TABLE [dbo].[user](
        [userID] [int] IDENTITY(1,1) NOT NULL,
        [fcode] [int] NULL,
        [scode] [int] NULL,
        [dcode] [int] NULL,
                


        
4条回答
  •  清歌不尽
    2020-11-28 01:25

    This can also be done in the GUI. Here's an example adding a multi-column unique constraint to an existing table.

    1. Under the table, right click Indexes->Click/hover New Index->Click Non-Clustered Index...

    1. A default Index name will be given but you may want to change it. Check the Unique checkbox and click Add... button

    1. Check the columns you want included

    Click OK in each window and you're done.

提交回复
热议问题