Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server / March 2008

Tip: Looking for answers? Try searching our database.

size of varchars

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ryan  putman - 03 Mar 2008 20:16 GMT
Someone else asked this and got referred to a Discussion that didn't
address the question so I'm going to ask again.

If you have a column that typically is going to be less than 12
characters in length, the obvious choice would be to use a
varchar(12).  However, what is the drawback to using something
larger.....like varchar(30)?

Thanks in Advance.
Ryan Putman
Andrew J. Kelly - 04 Mar 2008 01:28 GMT
None really, the overhead for a variable length column is there regardless.
But if the data should never be more than 12 chars in length by making the
column larger you risk someone putting bad data in.

Signature

Andrew J. Kelly    SQL MVP
Solid Quality Mentors

> Someone else asked this and got referred to a Discussion that didn't
> address the question so I'm going to ask again.
[quoted text clipped - 6 lines]
> Thanks in Advance.
> Ryan Putman
TheSQLGuru - 04 Mar 2008 14:46 GMT
Actually the choice to use var or not depends on what is being put into the
column, expecially the average length of the values.  If every value is
either 11 or 12 chars in length you should use a char(12) not a varchar.
This is more efficient both from a processing and storage standpoint.

Signature

Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net

> Someone else asked this and got referred to a Discussion that didn't
> address the question so I'm going to ask again.
[quoted text clipped - 6 lines]
> Thanks in Advance.
> Ryan Putman
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.