Subject Re: Returning Partial field Value
Author mbellisle_retire
--- In firebird-support@yahoogroups.com, Paul Vinkenoog <paul@v...>
wrote:
> Hello Mark,
>
> > How do I return a partial field value in sql in InterBase? (...)
> > SELECT Mid([SomeField],1,5) AS Expr1
> > FROM SomeTable;
> >
> > if returns the first 5 characters, starting from the beginning of
> > the value, how do I do the same with InterBase?
>
> Just to add to what others already told you about the substr() UDF:
>
> In Firebird (not in IB afaik) ib_udf also has a function substrlen,
> which you call like this:
>
> substrlen( string, startpos, count )
>
> with count the number of characters you want returned, and startpos
> 1-based (like in substr).
>
> Greetings,
> Paul Vinkenoog



Thanks everyone for your replies,
Unfortunately, I'm pulling the data from Interbase, so I can't
modify the db and add the udf for the functions. This question
related to another that I have on this board, where I'm having
trouble with pulling out data from IB, and the data contains the
trade mark (tm) symbol, but it IB errors every time I read those
records. It will do a search and find those records on that search
criteria, but when I move to the record, it errors.
So my cheat work around, was going to be search those records, rip
apart the value in the field, except the the one chartacter that I
don't want, replace it with a know chartacter, migrate the data,
then replace the known character back to the original.

So what I need is a way to use the substring functions, without
modifying the original db files of engine setup in any way, and
modify the string in the db, then do my migration.

Anyone have ideas on how to accomplish this?

Thanks for your help.
Mark