Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nvarchar(256)....?

Tags:

sql

sql-server

Why does nvarchar(256) seem to the be the standard for user names in SQL Server?

Any system functions that return a user name return nvarchar(256), the ASP Membership provider uses nvarchar(256)

256 seems like an odd number (yes, I know its even...) - 255 I could understand (1 byte address) but 256 doesn't make sense to me.

Can anyone explain?

like image 760
Frustrating Developments Avatar asked Dec 03 '08 21:12

Frustrating Developments


1 Answers

As programmers we automatically count starting at 0, but in this case nvarchar(0) would mean no characters. Turns out that 256 is your nice round number 2^8.

like image 131
Rich Avatar answered Oct 05 '22 06:10

Rich