Is there a reason the primary key is nchar while other fields are nvarchar?

I am working on an example from MSDN that uses a small database to demonstrate data-driven testing, and here is a simple diagram:

CREATE TABLE dbo.LogonInfoTest
   (
   UserId nchar(256) NOT NULL PRIMARY KEY CLUSTERED,
   Password nvarchar(256) NULL,
   IsValid bit NOT NULL
   )  ON [PRIMARY]
GO

My question is: What is the main reason for choosing nchar as the data type UserId and nvarchar as the password type?

+3
source share
1 answer

. NVARCHAR (256), , UserId 256 . . , SQL Server 2008 row-compression ( ), .

+5

Source: https://habr.com/ru/post/1764612/


All Articles