Monday, March 26, 2012

Max characters over column?

I am trying to bring down my column sizes in SQL Server 2000. Original
creater made them all varchar(1000) and that's way to much. A lot of
these have static lengths and some have a range. What I'm trying to do
is to pick a column, say last_name, and find out the maximum amount of
characters used for the existing data and then adjust accordingly. So
say of all the last names in the last_name column, it came out to 75
characters, I would make the column 100 characters. Just an example.
Any way to parse through a column in a query and find out the maximum
character length used for any given value?
Thanks.
JRSelect Max( Len( MyColumn ) )
From MyTable
How's that?
Colin.
"JR" <jriker1@.yahoo.com> wrote in message
news:1142894694.958758.314000@.i39g2000cwa.googlegroups.com...
>I am trying to bring down my column sizes in SQL Server 2000. Original
> creater made them all varchar(1000) and that's way to much. A lot of
> these have static lengths and some have a range. What I'm trying to do
> is to pick a column, say last_name, and find out the maximum amount of
> characters used for the existing data and then adjust accordingly. So
> say of all the last names in the last_name column, it came out to 75
> characters, I would make the column 100 characters. Just an example.
> Any way to parse through a column in a query and find out the maximum
> character length used for any given value?
> Thanks.
> JR
>

No comments:

Post a Comment