新建双主键表

GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[USER_INFO](
 [USER_ID] [nvarchar](100) COLLATE Chinese_PRC_CI_AS NOT NULL,
 [USER_NAME] [nvarchar](100) COLLATE Chinese_PRC_CI_AS NOT NULL,
 [USER_SEX] [numeric](1, 0) NULL,
 CONSTRAINT [PK_USER_INFO] PRIMARY KEY CLUSTERED
(
 [USER_ID] ASC,
 [USER_NAME] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

 

上面是生成的

 

 

CREATE TABLE USER_INFO
(
[USER_ID] VARCHAR(10) NOT NULL,
[USER_NAME] NVARCHAR(100) NOT NULL,
[USER_SEX] NUMERIC(1,0) NULL
CONSTRAINT pk_UserID_UserName PRIMARY KEY([USER_ID],[USER_NAME])
)

 

这个是手写的

你可能感兴趣的:(sql,server)