Re: Data types

From: Louis Davidson (dr_dontspamme_sql_at_hotmail.com)
Date: 10/14/04


Date: Thu, 14 Oct 2004 13:43:45 -0500

To echo Tibor's comments. If the data is variably sized, use varchar. If
all values are equally sized, use char. Ignore nulls unless you have large
fixed length values and most of them will be null and you have disk space
concerns. Programming with fixed length char value is a pain.

-- 
----------------------------------------------------------------------------
Louis Davidson - drsql@hotmail.com
SQL Server MVP
Compass Technology Management - www.compass.net
Pro SQL Server 2000 Database Design -
http://www.apress.com/book/bookDisplay.html?bID=266
Note: Please reply to the newsgroups only unless you are interested in
consulting services.  All other replies may be ignored :)
"Ann" <anonymous@discussions.microsoft.com> wrote in message
news:0b9301c4b210$2cd36990$a401280a@phx.gbl...
> Have a database that I'm not sure how to determine which
> to use... varchar or char. I've read up on it and am
> getting conflicting views. What if I have a lot of fields
> that are 8 characters or less? I thought I should use
> char, but then I've read that you shouldn't if those
> fields can be null. These fields can be null so should I
> use varchar then? How do I determine which to use? Thanks!


Relevant Pages

  • Re: Maintaining Field Length in .txt format
    ... If the types are VARCHAR, ... converts them to CHAR types. ... >are on a SQL Server 2000 environment and I can create ... The header information for the feed to be ...
    (microsoft.public.sqlserver.programming)
  • Re: returning @@RowCount
    ... use VARCHAR. ... CHAR will pad the data with spaces ... SQL Server MVP ... >> alter procedure stp_Family ...
    (microsoft.public.sqlserver.programming)
  • Re: Char and Varchar
    ... If the maximum length is short (<= 10 characters), ... maximum length, I also use CHAR. ... I use VARCHAR if long and short ...
    (microsoft.public.sqlserver.server)
  • Re: Char and Varchar
    ... If the maximum length is short (<= 10 characters), ... maximum length, I also use CHAR. ... I use VARCHAR if long and short ...
    (microsoft.public.sqlserver.programming)
  • Re: Char and Varchar
    ... correcting a small error and adding an ... > maximum length, I also use CHAR. ... >>How would a primary clustered key behave if it was built on a VARCHAR ... > forwarding pointer is changed. ...
    (microsoft.public.sqlserver.server)