I'm developing a SQL Server 2012 database and I have a doubt about nvarchar columns as primary keys.
I have this table:
CREATE TABLE [dbo].[CODES]
(
[ID_CODE] [bigint] IDENTITY(1,1) NOT NULL,
[CODE_LEVEL] [tinyint] NOT NULL,
[CODE] [nvarchar](20) NOT NULL,
[FLAG] [tinyint] NOT NULL,
[IS_TRANSMITTED] [bit] NOT NULL DEFAULT 0,
CONSTRAINT [PK_CODES] PRIMARY KEY CLUSTERED
(
[CODE_LEVEL] ASC,
[CODE] ASC
)
)
But now I want to use [CODE] column as primary key and remove [ID_CODE] column.
Is there any issue or penalty if I have a NVARCHAR column as PRIMARY KEY?
[CODE] column value must be unique, so I've thought that I can set an UNIQUE constraint to that column.
Any advice?
Aucun commentaire:
Enregistrer un commentaire