share
Stack OverflowWhat is the longest human name you can expect?
[+122] [44] Steve Hanov
[2008-09-24 16:09:24]
[ web-development database-design ]
[ http://stackoverflow.com/questions/128099] [DELETED]

What is the longest name that you should expect to get as input to your program or database?

I don't want to truncate unusual names, but I also don't want people to paste a novel in my name field as this could result in security problems. Has anybody ever been bitten by setting this field size too short?

(5) I always want to reply with funny responses and I would if I wasn't so afraid of overzealous down modders. - Sara Chipps
Just put them in a comment... wait... was yours a meta-funny answer? - Vinko Vrsalovic
Sara, you have plenty of rep to burn -- comment away! - Dana
(1) If a novel causes security problems, don't forget good old Robert '); DROP TABLE Students;-- from XKCD... - Steve Jessop
To the well... everybody came... what a shame... - Shog9
Excellent question. - Oddmund
[+108] [2008-09-24 16:15:19] Dynite [ACCEPTED]

Guinness World Record for Longest Name in the world belongs to a Mr. Adolph Blaine Charles David Earl Frederick Gerald Hubert Irvin John Kenneth Lloyd Martin Nero Oliver Paul Quincy Randolph Sherman Thomas Uncas Victor William Xerxes Yancy Wolfeschlegelsteinhausenbergerdorffwelchevoralternwarengewissenschaftschafe rswessenschafewarenwohlgepflegeundsorgfaltigkeitbeschutzenvonangreifeudurch ihrraubgierigfeindewelchevoralternzwolftausendjahresvorandieerscheinenersch einenvanderersteerdemenschderraumschiffgebrauchlichtalsseinursprungvonkraft gestartseinlangefahrthinzwischensternaitigraumaufdersuchenachdiesternwelche gehabtbewohnbarplanetenkreisedrehensichundwohinderneurassevonverstandigmens chlichkeitkonntefortpflanzenundsicherfeuenanlebenslanglichfreudeundruhemitn icheinfurchtvorangreifenvonandererintelligentgeschopfsvonhinzwischenternart Zeus igraum Senior, who was born in Munich in 1904 and lived in Philadelphia for most of his life. Apparently he shortened his name to Wolfeschlegelsteinhausenbergerdorff, and subsequently went by Hubert Blaine Wolfe, but the "Senior" indicates that he passed some form of his name to his son.


(9) For the curious, that's 802 characters including the "Mr." - Nick Johnson
(53) So a varchar(810) is probably safe... - Guy Starbuck
Unless you have the case of one-upmanship. Someone may name their child purposely to have a name longer than 802 characters to get into the Guinness Book of World Records. And then someone may want to one-up that. And so on. - Mike McAllister
(5) Right, but for their deliberate insensitivity to the constraints of SQL they deserve to have to truncate. - Steve Jessop
I think it may be a waste allocate that much space for every field in the system that uses it. - Brian G
His mother just called him "Hubie". - Kevin Little
(1) "So a varchar(810) is probably safe... ' LOL - David Hill
(2) you know what they say, a name is worth a thousand words :) - mattlant
(9) Do you think he got his entire name listed in the phone book? - Anders Sandvig
(1) Until he was 12 years old he had to take a note with his name to school to write his name on his school stuff. - Paco
1904? Maybe this guy's name is Mac? - Mark Stock
I wonder if his parents named him, or he changed his name to that? - RickL
Wow, that name will probably cause at least some buffer overflows :) - Jonas Gulle
(1) i wonder what his name means. - Dana
(19) That name is just a joke and for kicks and laughs. You can't have that name and go around looking for systems where it does not fit in. I see absolutely no harm in limiting it to 2-300 chars. If Mr. Adolph Blaine Charles David[...] makes a fuzz about it, tell him to talk with me. - Vargen
It looks like a bunch of first names and a long string of random chars in the middle, how did he end up with it? - kkaploon
(2) @kkaploon - his parents were code golfers. Try running it as APL. - Ian Mackinnon
interesting: newegg.com only allows 30 chars first name and 30 chars last name, 40 chars per address it seems - Stann
By the way how he spell out his name ;) - Ant's
1
[+58] [2008-09-25 02:02:19] mat_geek

Summary of the other answers:

If you do not support some ones name you may cause them hardship. (rdentato) This may lead to a Tort cases; i.e getting sued.


Guinness World Record for Longest Name is 802 characters. (Dynite)

You must support Unicode characters in the name. (rdentato)

You must support Punctuation like Hyphens; in all parts of the name. (rdentato) (RichH)

Accept one word names. (RichH)

Accept one letter names. (e k)


The structure, layout and number of names are dependant on the culture. e.g. 'Latin Americans and Spaniards use 2 surnames" (japinedaf)

Most countries have a different conventions to the USA. First Name,Initial,Last Name is inadequate even in the USA.

Usually American names have 3 parts, Latin names have 4 parts, Arabic names have 7 parts. (Mike Post)

Don't limit titles/appelations. Mr, Mrs & Ms are insufficient. People can have multiple titles e.g. Rev. Dr.. (Matt Lacey)


Consider using varchar(max) and let the database deal with it. (TheOtherScott)

Consider any interactions with legacy systems.Such as SSIS uses nvarchar(255) when importing data from Excel.


Use a single large free form field for the complete proper name. Use another free form field for the 'preferred' name. (mat_geek) Implement a sophisticated modern search if the records may need to be located by name. (mat_geek)


And as always, sanitise your input for SQL Injection attacks. (Chris Ballard) See: XKCD [1] (jeff)

[1] http://xkcd.com/327/

(4) "Most countries have a different conventions to the USA. First Name,Initial,Last Name is inadequate even in the USA." Strongly disagree. Most people in the US have a standard way of conforming their name to these three fields, even if their legal name doesn't fit. Check your 1040 form. - PeterAllenWebb
2
[+28] [2008-09-24 16:19:44] PeterAllenWebb

This is a great question, because its the kind of annoying but important decision developers face every day.

I recommend picking a reasonable limit and sticking with it. People with bizarrely long names usually have a shorter version that they will use if forced to. I would judge that 128 characters should be enough for any reasonable full name, and 64 characters should be enough for any christian name, middle name, or surname. Just make sure you enforce the same limit in the input field, UI code, database interaction layer, etc.

One great way to get a handle on these kinds of situations is to see how other people have dealt with the problem. Fire up some other applications or web sites from respected companies and see what they have done. Chances are if a solution worked for Google, it will work for you.

These days you'll also need to consider the possibility of Unicode characters in the name. Depending on how your users interact with your application, they could easily introduce these using a non-US keyboard. So make sure you accept them or reject them with an appropriate error message.


(10) Personally, I don't believe rejecting someone's name because they have non-ASCII characters is ever acceptable. Your application should cope with them. Period. - Matthew Farwell
(1) I'm inclined to agree with MathieuF - any application in this day and age should be able to handle Unicode. Even more so if it is a web based application of some sort. - Rob Z
How is this an important decision? Storage is freaking cheap! - Esteban Araya
(1) Not to mention you may have a requirement to store thier actual legal name, not an alias. - Nat
(1) Why 128 specifically? Why not 120, or 130? Or maybe 150. It's not like field sizes are bound to powers of 2. ;-) - community_owned
These are all valid points, sure. But if you make the length arbitrary you may be forced to use database field types that are not compatible between databases. Also, there is going to be a de facto limit on your input field. Even the IRS leaves a limited amount of blank space on their forms... - PeterAllenWebb
(1) christian name? i suggest you learn to accept muslim names too, or give up on buying oil and freeze in the dark. - Windows programmer
(8) zomg. are you serious? i apologize for a modicum of cultural insensitivity, but christian name is a common synonym for first name in the english speaking world. don't belive me? (en.wikipedia.org/wiki/First_name) - PeterAllenWebb
(1) @PeterAllenWebb: Yes, "christian" name is common. It's also WRONG (emphasis aimed at all who find this "equivalent", not you personally). - RolandTumble
@Jarrod: but it's nice to have a round number, isn't it? - Tikhon Jelvis
"Fire up some other applications or web sites from respected companies and see what they have done." I agree but disagree. Quickbooks and Outlook are probably two of the most well known apps from "respected" companies but both of them are failures when it comes to storing names. - HK1
3
[+23] [2008-09-24 16:15:09] Dana

One project I worked on handled mortgage/legal documents. I recall someone being added to the system who had eight middle names and their full, legal name was 514 characters long. So don't be stingy if it's a business app :P


(1) Good plan, always worth playing safe with legal apps - tjrobinson
(10) Or ... code legal apps proactively: if(person.name.length > 500){ courthouse.InitiateLegalNameChangeFiling.Run(person); record.name.save(sha1(person.name); record.person.comment.save(person.name);} - micahwittman
Wow, I would have said 255 characters and assumed I was erring far on the safe side. - Kip
@kip -- Yeah, "WTF!" was response when a user reported the name being truncated :P - Dana
4
[+17] [2008-09-24 16:20:03] Remo.D

Interesting enough, just yesterday I was reading about a woman who lost her flight home because her name was too long to be accepted by the check-in systems (would not fit in the boarding pass, they say and also had non-ASCII characters in it).

The name is: Ulrika Örtegren-Kärjenmäki and you can read the full story online:

http://www.thesun.co.uk/sol/homepage/news/article1716800.ece


5
[+15] [2008-09-24 20:56:29] Joe Pineda

I guess it depends on what your intended audience is. Latin Americans and Spaniards use 2 surnames, which for some reason is very confusing for Americans - I really hate being called by my maternal surname rather than my paternal.

Problem is most American-produced software seems to believe everyone in the world uses only one surname and one or at most 2 personal names. And since in the Anglo sphere surnames + names are usually short, sometimes you get unfortunate results like not being able to submit your whole legal name (and having problems afterwards for your passport says otherwise).

I myself have 2 personal names and some people I know have actually 3 or more, though this is really rare nowadays. Now then, if I recall it correctly a Russian's full name has the personal name, the patronymic (your father's name plus -ova or -ovich) plus the surname proper. And then East Asian names (as well as Hungarian ones) have surname first, personal name last. And Icelanders don't really have surnames at all, they only use patronymics after their personal names (think of Björk Guðmundsdóttir or Leif Eriksson - literally "Bjork daughter of Gudmund" and "Leif son of Erik", respectively). And Greek (and some others) surnames have different masculine and feminine forms (e.g. Gatsiopoulos versus Gatsiopoulou). In most Latin America and Quebec, married females are still referred to legally by their single's surname. Etcetera.

If you intend your software to be used by English speakers only, 50 chars for name, middle and surname each may be fine. If you're willing to go international at some point, you should probably reserve far more space. I'd suggest also keeping surnames and names in separated fields, if possible use 2 surname fields (that's how we do it usually in Mexico). Probably even 3 if you want to add the option of "single surname" (or the opposite, married surname) for females. If possible, use the terms "family name" or "surname" rather than "last name".

All in all, it's not as simple a subject as it seems...


I agree that for true cross-cultural operation, it's probably necessary to offer these extra fields. But they're going to confuse the hell out of a lot of people. Perhaps offer a quick link, "my name doesn't fit here" and then let them choose from a list of name formats. - PeterAllenWebb
6
[+13] [2008-09-24 19:03:50] RichH

My wife has a hyphen in her first name and regularly comes across systems that only support hyphenated last names. Worry about your special characters and not just your length.

I also work with someone with just a single name (no last name ... or is it no first name?). Be careful with your validation too!


(5) So does my wife. Sweet ElizaHyphenBeth. - Nathan Long
7
[+13] [2008-10-29 06:51:09] Osama ALASSIRY

Arabic names can be as many parts as you want, I could give you my name in 20 or 30 parts, that would include many generations and family/tribe names.

It's basically a linked list of "first names", each pointing to their fathers. and a tree of families and tribes that belong to eachother.

we sometimes like to use the word bin, meaning son of.

You can call me:

  • Osama
  • Osama Khalifa (Khalifa is my father)
  • Osama bin Khalifa
  • Osama Alassiry (Alassiry is my Family Name)
  • Osama Almaadeed (Almaadeed is my Tribe Name)
  • Osama Khalifa Alassiry Almaadeed
  • Osama bin Khalifa bin Sultan Alassiry Almaadeed (Sultan was my grandfather)

(it's goes on infinitely, I have a list of many of these names on my blog).

That's why I don't like it when you have separate fields, I prefer to have one field called "Full Name", and the user would fill it in the way he/she would prefer. First/Last is something I don't mind, But I don't have a "Middle" name ...


(4) Osama bin What? You're lucky America's "no fly" list only uses first names and last names. If they checked middle names they'd never let you fly. And if you reported all your middle names, they'd jail you for crashing their SQL servers. - Windows programmer
(1) Actually the English transliteration name on my passport is "Osamah Khalifa S A Al-Maadeed", which confuses many people (maybe the maximum is 30 or 32 characters, the Arabic is correct). - Osama ALASSIRY
(1) If you use a single column, how do you sort by last name? If you use an nvarchar(max), you have relegated yourself to table scans whenever you search or sort on name. - Thomas
W3c has this question answered... w3.org/International/questions/qa-personal-names - Osama ALASSIRY
8
[+10] [2008-09-24 17:46:13] QBziZ

Why did no one mention

Johann Gambolputty de von Ausfern-schplenden-schlitter-crasscrenbon-fried-digger-dingle-dangle- dongle-dungle-burstein-von-knacker-thrasher-apple-banger-horowitz- ticolensic-grander-knotty-spelltinkle-grandlich-grumblemeyer- spelterwasser-kurstlich-himbleeisen-bahnwagen-gutenabend-bitte-ein- nurnburger-bratwustle-gernspurten-mitz-weimache-luber-hundsfut- gumberaber-shonedanker-kalbsfleisch-mittler-aucher von Hautkopft of Ulm?

clicketyclick [1]

[1] http://www.youtube.com/watch?v=UDPqB9i1ScY

The greatest name in German Baroque music! :) But it's meager 426 characters pale in comparison with Hubie... - Constantin
Ah, I see. Poor Johann always seems to get the short end of the stick. - QBziZ
9
[+9] [2008-09-24 18:42:49] Even Mien

varchar(max) and let SQL Server sort out the rest!


(3) ...make that nvarchar(max) instead of varchar(max) if you're going to store names... - KristoferA - Huagati.com
(3) If you use nvarchar(max), you cannot put an index on the column. That means any search on name will result in a table scan. If you allow someone to enter 2GB of text for a name, someone will. - Thomas
10
[+8] [2008-09-24 16:16:54] tjrobinson

I don't think there can ever be a correct answer to this as someone could be born tomorrow with the longest name in the world + 1. People with excessively long names are probably used to shortening them due to restrictions on size elsewhere in their lives, so I would go with your experience of the particular language/culture you're dealing with, add a bit more on top and hope you don't offend any edge cases by not giving them enough space.


Couldn't agree more. People whose parents or numerologists cursed them with ridiculously long names KNOW there are situations in life where they will have to abbreviate it. Suing because a form or a web site doesn't allow you to have the full text of King Lear for a surname is frivolous. - Jens Roland
And as for a reasonable field size, simply go as high as your design will let you, and don't limit it to 'firstname initial surname', at least not without allowing spaces - Jens Roland
So, you're leaning towards infinity? - hughdbrown
11
[+6] [2008-09-24 20:42:23] e k

on a related note...make sure that you can take single character last names. I have a few friends with the last name "O", who are always having problems signing up for new accounts anywhere they go


12
[+5] [2010-12-08 15:42:29] NotDan

Something else to keep in mind:

Falsehoods Programmers Believe About Names

http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/


13
[+4] [2008-09-25 01:56:17] mat_geek

You need to declare what your requirements are. Is the name entered required to be legally correct? Is this a small embedded system or a gigantic intelligence database?

Since the content and layout of names is arbitrary and culturally dependant you should not hard code any assumptions.

Just provide one very large (1024) or unlimited size Unicode field for their proper name. Make sure it is only sanitised to prevent injection attacks.

Provide another sizable field for their 'preferred' name. This can be used on envelopes and in customer calls. It may bear no relation to their proper name, but that is irrelevant; e.g Hubert Blaine Wolfe.

Most of the requirement to order names is based on the need to be able to quickly find a record in a government record warehouse or in a phone book. So don't bother trying to group them unless there is an explicit requirement specifying and exact grouping scheme.

If you need to be able to find people by name implement a modern search. Return partial matches after the user has entered three characters; (but allow the user to search on one). And order the results so exact matches are first, matches on a whole word are next, then matches on part of a word are last.


14
[+3] [2008-09-24 22:41:33] Mike Post

There's no easy answer to this question.

The answer depends on what sort of data you expect to handle with your system. Do you expect only Americans to exist in your system? In that case Latin names could be considered your special case. But if you expect to deploy world wide you'll need to handle American names (3 parts), Latin names (4 parts), Arabic names (7 parts I think), Asian names (no idea on number of parts), etc. The ISO 8000 standard attempts to provide a framework to answer this sort of question, but does not answer it directly.

Also don't forget to account for the multibyte character sets. For example, a name written in the Traditional Chinese character set may be 15 characters, but those 15 characters may take upwards of 45 bytes. 1 character != 8 bits

If you're working with Western names written in Western alphabets, three fields of 256 characters each should cover most of your cases. Or you could follow the lead of the United States Postal Service for internal shipping labels: the combination of first, middle, and last names cannot exceed 32 characters including separating spaces) PDF link [1]

[1] http://www.usps.com/webtools/_pdf/InternationalLabelsv12.pdf

(1) The USPS standard is absolutely idiotic. 32 characters is just enough for someone with a regular Anglo-Saxon name, but once you start adding in people whose names aren't of a British background, you quickly become constrained. Nothing wrong with your answer, just griping about the American way... - Chris Charabaruk
15
[+3] [2008-09-24 23:45:23] Mark Stock

6 characters max, all upper case and padded with spaces. The mainframe let's you store eight but let's not get ahead of ourselves. And, to save space only use two digits for the year.


16
[+3] [2008-09-24 20:19:35] Kommander Keen

I agree with the VARCHAR(MAX) statement above. I would have upvoted it instead of agreeing with it, but I guess I'm not allowed to do that yet. I don't think the length of your database field is going to compromise your security at all.


It is if you program in C or C++. Don't do that - Orion Edwards
17
[+3] [2008-09-24 16:11:55] Dennis

When I program I usually use 25 character string for the first name and 50 character string for the last name. Using those settings I have not yet run into any problem with it being too short.


18
[+2] [2008-09-24 16:26:40] Steve Jessop

The longest name in an NFL stats db I have is Chris Fuamatu-Ma'afala. But that only contains players with offensive stats.

I don't know why I even remember that.

I read an article on the BBC a while back about Sri Lankan brothers with very long names, who did find that they had trouble with some database systems. Hang on ...

Hm, can't find it. But the full name of the cricketer generally known as "Chaminda Vaas" is Warnakulasuriya Patabendige Ushantha Joseph Chaminda Vaas. And it's not just Sri Lankans - there is an English cricketer named Ebony-Jewel Cora-Lee Camellia Rosamond Rainford-Brent ("EJCLRC Rainford-Brent" on the scorecard, even though that reverses two of her names she apparently prefers it).

In practice, unless you're doing government work anyone with an extremely long name will probably use a shortened version of it for practical purposes.


I'm sure that "Chris Fuamatu-Ma'afala" would be mis-handled by a lot of apps - as it has the ' in it. this is VERY common in Pacific Island names - Tongan, Samoan, Niean etc. Important to get that right anywhere in the south pacific (eg australia and new zealand) - Nic Wise
Excellent - I don't write database apps myself, but he's my new favourite test case for when I do. Along with Donte' Stallworth. - Steve Jessop
If anyone needs a database textbook to learn how to handle ' in names, O'Reilly publishes some. - Windows programmer
19
[+2] [2008-09-25 08:07:27] Gustavo Rubio

I think that deppends on the country you are developing your application or should I say the culture you target.

I've worked on Mexico for the government and had the opportunity to come across these kind of problems and you wouldn't believe what you might find. People that were born before the 20's (there were records of these people even if they were dead) had very long names in Mexico. We used a 50 character standard for each field.

For example, my full name is Gustavo Adolfo Rubio Casillas which is "pretty long" for someone born in the U.S. for example where the mother's last name is not important but in latin american countries it is. Another difference is that many people in english-spoken countries abbreviate the middle name as in John F. Kennedy

I'm working now on a project for a car insurance company in the U.S. and I have access to the insureds database and the names seem to be shorter than the ones I worked with on Mexico so definitely it depends on the place where your application will be used, german names for example tend to be even longer than latin american ones.

And finally, it also deppends on the system/technology. For example, for the insurance application that we are developing we have to keep certain "standards" because the customer keeps their data in an iSeries server from IBM which uses the file-based AS400 database and they have more limits with the fields lengths than, say SQL Server. This information must be also exported to a file that uses an insurance standard that has its limits so no matter if our SQL server database or even the AS400 supports say, a 250 char length field, we have to truncate the data in order to fit in these XML files.

So summarizing it is a combination of factors, it's the place where your deployment will be made, the technology that you are using, the techology that you have to interoperate with and business rules.


20
[+1] [2008-09-29 10:48:39] Matt Lacey

I'd also like to mention titles (or appelations) as part of peoples names.

I've known companies who have lost business because they couoldn't address their customers properly. Mr, Mrs & Ms aren't enough.

Then there are people who have multiple titles. For instance, I know a Rev. Dr.


Really? A business lose customers because the auto-generated form letters from the business didn't properly address the customers? I find that very hard to believe. - Tundey
I know of another instance where one customer insisted that his record and invoices read Mr. President [name]. From what I heard, he was a very good customer too. So yes, be careful with those assumptions - Jens Roland
21
[+1] [2008-10-03 20:22:45] Philippe Grondier

I had once to find an answer to this question while building a database for an international summit. I quickly found that longest family name are typically from madagascar (where some family names can reach 20 to 25 characters), while longuest forenames were usually found in France ("Paul-Henri Emmanuel" is a nice example). By combining the 2 infos, I decided that 52 characters (that was a long time ago, so don't ask me why 52 instead of 50 or 60!) was the correct size.

We finally registered 10 000 persons coming from approximatively 60 different countries. And it worked.


I like this answer because it's from someone who has actually done something like this, rather than just random conjecture. - John Biesnecker
22
[+1] [2008-09-24 20:23:45] mbac32768

At the very least you want to make sure you can accommodate world famous, Emmy-award winning actor Kiefer William Frederick Dempsey George Rufus Sutherland [1] as a client.

[1] http://en.wikipedia.org/wiki/Kiefer_Sutherland

And if I'm counting right, that's 56 characters including whitespace - Jens Roland
23
[+1] [2008-09-24 19:50:12] community_owned

New systems are usually going to be expected to interact with legacy systems in some way, and that's a decent thing to base your decision on. That way, if anyone questions you later, you can always say you based your decision on software package X because your software imports/exports to that system.

If you have nothing else better to base your decision on, use nvarchar(255) because that's the default type when SSIS is importing data from an Excel spreadsheet.

Never make arbitrary decisions. Always base it on something, anything.


I agree with this, but it requires a caveat. It's a principle that requires responsible use - it seems to me to be most often taken as "don't worry about it too much, just make sure you have an excuse if it's not right". - jTresidder
24
[+1] [2008-09-24 20:10:07] community_owned

Also remember that relatively few countries follow the American first name, middle initial/name, last name pattern. In Brazil it's common to have more than one "first name" and more than one "last name", while few people would consider themselves to have a "middle name".


25
[+1] [2008-09-24 16:36:32] Chris Ballard

Good question. I suppose a follow on question would be how to deal with someone called Mrs. x'; DROP TABLE users; --


Just bring the name in via parameter and all will be well. - David B
See xkcd.com/327 for more on this - robintw
Now I now what to name my next child. - KevDog
@robintw: aha, I knew I had seen that joke before somewhere! - Chris Ballard
little bobby tables we call him! - Pete
You win the internet. - Chris Charabaruk
26
[+1] [2008-09-24 16:55:21] roosteronacid

Looking at my VISA card (Danish) my full name (Thomas Angelbo Christensen) almost spans the entire card. That's 26 characters including spaces.

That's one form of restriction on name-length.

I always go with 256 characters for full names. Which I think is more than enough.


Does the credit card number fit? How long is the full number (and what its value). Also the the expiration date and those three numbers on the back. I'm just curious. - Kip
Stupid VISA cuts off the second half of my last name, because they won't let me use the short version of my first name (which is longer by one character). - Chris Charabaruk
(2) Ôn my passpart (credit card size) my name is continued on the back side. - GvS
Haha, Kip! Awesome! :) - roosteronacid
27
[+1] [2008-09-24 17:41:07] David Hill

I'd also go with 256 characters, because it's a nice round number. 256 is kind of my default "good starting point" field length.


amusing how 2^n is a nice round number :) - Pete
Well, it is. When you're counting in bases of 2^n. - Chris Charabaruk
28
[+1] [2008-09-24 18:10:25] Sameer Alibhai

When I was in school, there were some south Indians in my class with names so long they would always be cut off on the class list. Here is a few examples: http://www.kamat.com/econtent/amusements/saythis.htm


29
[+1] [2008-09-24 18:14:12] Eddie

Good Question.

I typically have fields for first, middle, and last names that are limited in size to what I would expect my users to input. Majority of the time I leave the 50 character default MsSql provides, but you have to take into consideration your users and type of application. Some applications may only need a nickname while others need full name. Plus, users from different parts of the world are going to have different average name lengths. Of course if your app is global then best to go with the worst case.

I am currently working on an application in which having the exact legal name will be important. After reading this, I am thinking of having an additional field of legal name that should, by the looks of Guinness World Records, be able to hold more than 791 characters. Maybe 1024 characters for a good round number and future considerations? Then I would use a combination of first, middle, and last for average display purposes whilst still providing the ability to store full legal name.


30
[+1] [2008-09-24 19:28:33] jpeacock

This is the modern world, storage is cheap. Why limit a name field to 30chars? Set the DB field to 1024 each for first, middle, last. For the interface, set the display size to something that's readable (30/30/50?) but keep maxlength at the DB limit.

This should work for enough people that the tail will be really small (there will always be exceptions unless you support an unlimited size).


31
[+1] [2008-09-24 16:25:44] marcospereira

"Pedro de Alcântara Francisco Antonio João Carlos Xavier de Paula Miguel Rafael Joaquim José Gonzaga Pascoal Cipriano Serafim de Bragança e Bourbom" was Peter I's complete name [1].

Anyway, Dynite answer is so much more funny. :-D

[1] http://pt.wikipedia.org/wiki/Dom_pedro

32
[0] [2008-09-24 16:23:41] Cheery

I guess safe assumption is that a human rarely has longer than 256 characters long full name. 256 characters is roughly 3 lines, assuming you have 80 character-limit on each line.

Actually, for european names... they aren't often really long, perhaps even 64 characters would go and most people would be ok with it. If you want to make sure you could use 128 characters. (I'd be sure, since 128 characters are really nothing with todays memory standards.)

Unless you are writing a government database for mexicans (there you wouldn't limit the name lengths), I guess you could use 64 as the character limit for the name field.

To your knowledge, I don't believe anyone would have ever written a novel to their name field. It's not even useful anyway since they ought do that thousands of times to actually give a dent. It's somewhat equivalent to spamming though. Not anything I would care of, since often you don't allow links in the name fields.


33
[0] [2008-09-24 16:13:01] pjz

I've got friends with a long, hyphenated last name that regularly get bit by this. I'd say 30 chars each for firstname and lastname, or 50 chars if they're in one combined field.

Overkill is good though, and storage is cheap to free these days, so take the above as a minimum and multiply by your favorite overengineering factor.

this link [1] has some interesting data on it.

[1] http://everything2.com/index.pl?node_id=1534419

Storage may be cheap but bandwidth still costs. Doing things efficiently is still the best thing to do. There is a trade-off. - Optimal Solutions
what bandwidth are you concerned about? when displaying it to a client from a server, you'd probably just transfer it as a string, using only as many characters as are necessary. if you're copying from one database to another, that would e on a fast, local network. - Kip
34
[0] [2008-09-24 19:35:14] Rui Vieira

Just hope with don't get this user [1]

[1] http://en.wikipedia.org/wiki/Brfxxccxxmnpcccclllmmnprxvclmnckssqlbb11116

35
[0] [2008-10-04 17:50:38] pookleblinky

I don't think maximum lengths are as important as minimum lengths. For every Johan Gambulputty* you'll likely get 100 very annoyed "I"s and "Wu"s and "O"'s


36
[0] [2008-10-01 17:44:03] Jeff

Wanted to add a quick comment re: sanitizing your names (see mat_geek's comment above).

Check out the following comic that help's show why it's important to protect your database from SQL injection.

http://xkcd.com/327/


37
[0] [2008-09-27 18:25:45] arin sarkissian

I'll usually start the site with a generous length for both first and last name... maybe even a varchar(255). If there's no "find a user" type of feature in the UI you're probably not going to index the firstName & lastName fields so starting off big isn't a huge issue...

After a reasonable stream of data has come thru (x months worth, n records) I'll examine the db table and see what my users' contributed data is like and possibly make adjustments from there.

But really, unless you're indexing the data, its not that big of a deal if you have "fat" columns (in this situation). Disk space is cheap... pissing off a potential user/customer is expensive.


38
[0] [2008-10-29 07:33:13] shahkalpesh

Doesn't that make all the applications (web/windows) unusable to accept a legit long name? :)


39
[0] [2008-11-04 18:44:59] Kevin Fairchild

GLASTONBURY, England, Nov. 3 (UPI) [1] -- A British 19-year-old has officially changed his name to "Captain Fantastic Faster Than Superman Spiderman Batman Wolverine Hulk And The Flash Combined." The Glastonbury, England, teenager -- originally named George Garratt -- said his new name, which is thought to be the world's longest, has so outraged his grandmother that she is no longer speaking to him, The Telegraph reported Monday. The teen said he used an online service to officially change his name for a $20 fee. "I wanted to be unique," Captain Fantastic said of his name choice. "I decided upon a theme of superheroes."

[1] http://www.upi.com/Odd_News/2008/11/03/Teens_Fantastic_new_name_Super_long/UPI-90361225751268/

40
[0] [2008-11-04 19:03:27] Tundey

Are you writing a general purpose application that'll be used by the entire world? If not, just pick the logical choice based on your application's potential userbase. Otherwise, use varchar(max) as suggested. Worrying about the relatively few odd people with extremely long names will get your nowhere.


41
[0] [2008-12-30 07:43:54] starblue

The longest ordinary german name I came across is "Sabine Leutheusser-Schnarrenberger", a politician in Bavaria. Just one first name and a last name, nothing fancy.


42
[0] [2010-11-11 05:20:26] Frank Computer

Realistically, the longest names I've come across are German, African and perhaps some other European names, but I would set a VARCHAR limit of 40 for FirstName and LastName. You can also create additional columns like: LegalName, ShortName, AliasName, etc. to augument a persons identity. Here in Puerto Rico, as in other Latin-American countries, they add SurNames (Mothers maiden name) when identifying a person. Example: JUAN RIVERA RODRIGUEZ (please note that they are similar to compound last names which are also sometimes used in USA , e.g. EVERT-LLOYD, but inserted only into a LastName column.) All app I have developed have SurName VARCHAR(1,40) to further identify a particular person.


43
[-2] [2008-09-25 04:21:18] Peter Turner

If you need to ask this question then you're obviously not at 7th normal form.

Ideally you would create two tables

LastNames
+-------------------------------------------------------+
|  LastNameID  |  ThirtyOrSoCharacters | NextLastNameID |
+-------------------------------------------------------+

When NextLastNameID = -1 or null or something, then you're done. Don't try sorting or querying this table or anything.


44