Subject RE: [firebird-support] Inserting into Table needing truncate for varchar
Author Alan McDonald
> >>I have an App that uses "Insert into Table Select Varchar ....
> >>
> >>The problem is that sometimes the Varchar is "bigger" than the defined
> >>receiving field. Is there any way to "truncate on the fly"... so the
> >>app can insert regardless of the size of the "selected" field?
> >
> > Yes. Use CAST( aVarchar as Varchar(n)), where n is the size of the
> > target column.
>
> CAST can't truncate string (only if cut characters are spaces).
>
> CAST is done implicitly in "Insert into Table Select Varchar",
> so you know it can't work.
>
> Ivan
>

huh? I'd better go thru all my SPs, then and change them becuase they all
rely on cast to truncate. And it produces no error - just the desired
results.......
Alan