Ryan Mahoney wrote:
>
> Is it possible to select rows from a field based on the length of the data
> in a varchar field?
length works fine in a select on a varchar field.
select a from b where length(a)=5;
You didn't ask for this, did you?
Grabbing different columns depending on values of another another column
can be done with "case":
select
case
when length(col_var)<5 then col_a
when length(col_var)>5 then col_b
else col_5
end
from
tbl
;
With kind regards / Mit freundlichem Gruß
Holger Klawitter
--
Holger Klawitter
holger@klawitter.de http://www.klawitter.de