What is a reasonable length limit on person “Name”

2019-01-29 22:21发布

I have a simple webform that will allow unauthenticated users to input their information, including name. I gave the name field a limit of 50 characters to coincide with my database table where the field is varchar(50), but then I started to wonder.

Is it more appropriate to use something like the Text column type or should I limit the length of the name to something reasonable?

I'm using SQL Server 2005, in case that matters in your response.

EDIT: I did not see this broader question regarding similar issues.

标签: sql html textbox
11条回答
仙女界的扛把子
2楼-- · 2019-01-29 23:03

In the UK, there are a few government standards which deal successfully with the bulk of the UK population -- the Passport Office, the Driver & Vehicle Licensing Agency, the Deed Poll office, and the NHS. They use different standards, obviously.

Changing your name by Deed Poll allows 300 characters;

There is no legal limit on the length of your name, but we impose a limit of 300 characters (including spaces) for your full name.

The NHS uses 70 characters for patient names

PATIENT NAME
Format/length: max an70

The Passport Office allows 30+30 first/last and Driving Licenses (DVLA) is 30 total.

Note that other organisations will have their own restrictions about what they will show on the documents they produce — for HM Passport Office the limit is 30 characters each for your forename and your surname, and for the DVLA the limit is 30 characters in total for your full name.

查看更多
贪生不怕死
3楼-- · 2019-01-29 23:04

The average first name is about 6 letters. That leaves 43 for a last name. :) Seems like you could probably shorten it if you like.

The main question is how many rows do you think you will have? I don't think varchar(50) is going to kill you until you get several million rows.

查看更多
甜甜的少女心
4楼-- · 2019-01-29 23:05

I usually go with varchar(255) (255 being the maximum length of a varchar type in MySQL).

查看更多
做个烂人
5楼-- · 2019-01-29 23:06

We use 50.

查看更多
可以哭但决不认输i
6楼-- · 2019-01-29 23:07

What you're really asking is a related, but substantially different question: how often do I want to truncate names in order to fit them in the database? The answer depends both on the frequency of different lengths of names as well as the maximum lengths chosen. This concern is balanced by the concerns about resources used by the database. Considering how little overhead difference there is between different max lengths for a varchar field I'd generally err on the side of never being forced to truncate a name and make the field as large as I dared.

查看更多
登录 后发表回答