MBC Computer Solutions Ltd.

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Tuesday, 7 August 2007

Choosing appropriate field lengths

Posted on 13:29 by Unknown
For every project that I work on I seem to have the same argument with myself about field lengths (mainly when dealing with SQL) - just how long should they be? What is appropriate for first name, last name, and email address columns?

I used to start big, 100 characters for first/last name and 255 characters for email addressses. Recently I was revisiting my thinking of lengths so I decided to run some stats on the one of the larger DB's that I maintain. Here's what I found.

First Name: Max 27, Avg 6
Last Name: Max 27, Avg 6
Email: Max 76, Avg 22

The first thing that hit me was, geeze, a 76 character email address - that's a lot of typing! The second thing was that my column length allocations were on the really high (and unnecessary) end of the spectrum.

I always like to leave a bit of room because users always seem to do the unthinkable, so moving foward, my allocations look like:

First & Last name: 35
Email: 100

Since I mainly use variable length columns (varchar/nvarchar), storage is never really an issue, however when you start allocating 255 characters to each column it is easy to hit the table maximum (w/o BLOB's). Knowing that I can tone down my allocations gives me some re-assurance that I am less likely to reach the maximum when adding new columns down the road.
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • How to change the temperature scale on a Honeywell T6575 Thermostat
    [The complete documentation can be found at http://customer.honeywell.ca/techlit/pdf/95c-00000s/95c-10897.pdf ]   This was bugging me fo...
  • Why does iTunes setup need to close Outlook?!
    Everytime I update iTunes I remember why I left it so long - the install process is quite annoying! Can someone please explain to me why it...
  • Dell 2009W's Finally Arrive
    I had previously   written about the new Dell 2208WFP 22" Wide Screen LCD's that I had purchased and immediately sent back due to ...
  • Mac OSX 10.5.2 Freezing Intermittently
    I've been having an issue with my MacBook (you know, that computer I hide under my desk most of the time) where intermittently, the UI w...
  • Recursively finding controls - where to start?
    I love hearing about bugs and problems in components I have authored.  Most people hate hearing about bugs (I assume because they like to th...
  • ScottGu’s Color Scheme for Visual Studio 2010
    ScottGu was nice enough to provide the world with his awesome Visual Studio 2008 color scheme.  I’ve been using this for many years now an...
  • Windows Search 4.0 Released .....and searching finally works!
    I've been dealing with Outlook 2007's search problems since installing it way back then.  Most frequently, I'd search a keyword;...
  • How to query your BES database for a list of users
    I was asked to generate a list of all our BES users, including their name, phone number, PIN, IMEI and device number.  Sure, I could have co...
  • C# – Converting IP’s to Numbers and Numbers to IP’s in 2 lines of code
    I don’t know why everywhere I searched had such complex implementation of this, but converting from a dotted IP to a number (integer) and ba...
  • Using SQL PIVOT with non-aggregate column
    I was banging my head on my desk for a while over this one, hopefully this will save you the pain… I wanted to use SQL 2005’s PIVOT functi...

Blog Archive

  • ►  2012 (1)
    • ►  February (1)
  • ►  2010 (1)
    • ►  April (1)
  • ►  2009 (7)
    • ►  December (1)
    • ►  November (1)
    • ►  October (1)
    • ►  July (1)
    • ►  April (2)
    • ►  February (1)
  • ►  2008 (36)
    • ►  November (3)
    • ►  October (2)
    • ►  September (1)
    • ►  August (1)
    • ►  July (2)
    • ►  June (6)
    • ►  May (4)
    • ►  April (1)
    • ►  March (4)
    • ►  February (7)
    • ►  January (5)
  • ▼  2007 (35)
    • ►  December (1)
    • ►  November (9)
    • ►  October (3)
    • ►  September (6)
    • ▼  August (7)
      • Yes, you can use C# controls in VB.NET code
      • Blackberry 8800 software update - where are you?
      • C# ? operator - Nullable shorthand
      • Assigning an programs output to a variable in a ba...
      • System.Net.WebException from XmlDocument.Load
      • Choosing appropriate field lengths
      • Why don't things just work in Safari?!
    • ►  July (9)
  • ►  2006 (3)
    • ►  May (3)
Powered by Blogger.

About Me

Unknown
View my complete profile