Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

runrig (3385)


Just another perl hacker somewhere near Disneyland

I have this homenode [] of little consequence on Perl Monks [] that you probably have no interest in whatsoever.

I also have some modules [] on CPAN [] some of which are marginally [] more [] useful [] than others.

Journal of runrig (3385)

Wednesday April 14, 2004
05:10 PM

Varchar columns

[ #18336 ]

I just noticed that in our SqlServer databases we have alot of 'varchar(1,0)' columns. I know that if you have a long character column that tends to be short or blank, you can save space by making it a varchar instead of a char, but it can't be worth making a varchar for a one character field, can it? (And in most cases, the fields I'm looking at will always be 'Y' or 'N').

Update: In my homegrown DBI sql query tool the '0' above is from the 'SCALE' for numeric columns, which I display if the value is defined (whether or not the column is numeric). I'm not sure if this is also the reserve length for varchar columns, or if SqlServer happens to define it as zero.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • VARCHAR with length 1 will cost you an extra byte per column and row, plus unless your DB's optimizer is very smart it might make some operations slower.