all groups > sql server programming > march 2004 >
You're in the

sql server programming

group:

varchar vs char


Re: varchar vs char Joe Celko
3/19/2004 8:21:32 AM
sql server programming: [quoted text, click to view]

For what purpose? For what data element? I know this is a radical idea
for a lot of newbie programmers, but why don't you try designing the
logical schema first, implement it, test it and worry about any
performance issues at the end of the process?

"FIRE! Ready! Aim!" is not a good way to dothings.

--CELKO--
===========================
Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are.

*** Sent via Developersdex http://www.developersdex.com ***
Re: varchar vs char Aaron Weiker
3/19/2004 11:00:18 AM
[quoted text, click to view]

varchar is a variable length
only takes up the bytes that equal the length of the data

char is a fixed length
will always take up XXX number of bytes in the table

I'm not aware of any indexing benefits of one versus the other, but I
imagine that there may be a slight benefit for using char.

--
Aaron Weiker
http://blogs.sqladvice.com/aweiker
http://aaronweiker.com/
varchar vs char toylet
3/19/2004 11:51:18 PM

Which one would be preferred? Will the choice affect index performance?

--
.~. Might, Courage, Vision. In Linux We Trust.
/ v \ http://www.linux-sxs.org
/( _ )\ Linux 2.4.22-xfs
Re: varchar vs char Hugo Kornelis
3/20/2004 12:28:22 AM
[quoted text, click to view]

Quote from BOL:

* Use char when the data values in a column are expected to be
consistently close to the same size.
* Use varchar when the data values in a column are expected to vary
considerably in size.

Best, Hugo
--

Re: varchar vs char toylet
3/20/2004 7:56:59 AM
Well I wanted to know the implicatinos behind the choice of a data type
when implementing a design decision.

[quoted text, click to view]

--
.~. Might, Courage, Vision. In Linux We Trust.
/ v \ http://www.linux-sxs.org
/( _ )\ Linux 2.4.22-xfs
AddThis Social Bookmark Button