Results 1 to 2 of 2

Thread: Kinder garden question about datatype

  1. #1
    Join Date
    Dec 2003
    Posts
    140

    Kinder garden question about datatype

    Hi all,

    Suppose I know that the maximum length for my customerID field will not be more than 10 characters (95% of times this will be numeric digits like 1000127, while 5% of the times this may be alphanumeric like 1001MT56).

    Given this scenario should I use char(10) as the datatype for my customerID field or should I use varchar(10). Can you kindly share your expert advise from a performance aspect.

    BOL has a lot of information but I could not the exact answer to this "kiddy" questions and thus ended up posting this question here.

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    I'll use char(10) in this case since varchar type will add 2 bytes overhead and sql has to recalculate length every time you update the value in the column.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •