But when using CHAR within a SQL Statement don't you need to use a
REPEATSTRING or a TRIM statement for proper validation so ensure that the
value in the database matches the same length of the variable itself?

I mainly use VARCHAR set to a size of the largest value expected. I only use
CHAR when I know the length will always be the same such as:
Where sex = 'M' or sex = 'F'

This case sex would have a CHAR(1).

Other than a small optimization within the query, coding would be a bit more
to account for the complete length of the string?



-----Original Message-----
From: Will Tomlinson [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 27, 2007 8:53 PM
To: CF-Talk
Subject: Re: SQL Data Type

>What are the benefits on using a CHAR field versus VARCHAR?
>

Well, using char can be a bit speedier when querying, but takes up more disk
space. You want to use char when all the data in that field will be close to
the same length. the db will pad it, so it ends up taking up more space than
if you used varchar and it set the length to the exact length of the data. 

I just converted some varchars to char as a small optimization to an app. 

Will 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get the answers you are looking for on the ColdFusion Labs
Forum direct from active programmers and developers.
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:293907
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to