Subject | Re: [ib-support] Substring? |
---|---|
Author | Claudio Valderrama C. |
Post date | 2001-08-18T03:26:06Z |
"Joe Martinez" <joe@...> wrote in message
news:3B7D5364.86BDB8BC@......
set myfield = substring(myfield from 4)
where...
update mytable
set myfield = substr(myfield, 4, 32765)
where...
update mytable
set myfield = substrlen(myfield, 4, 32761)
where...
The bold note is that neither of them work with IB, but with FB:
- substring is the ANSI SQL function implemented in FB.
- substr in IB will return NULL if the end position is greater than the
field's length; FB substr will return from start to end_pos or end of
string, whatever happens first. It seems more sensible.
- substrlen is a variation devised for FB. Instead of working as
(s,begin_pos,end_pos), it works as (s, begin_pos,length).
C.
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase® WebRing
news:3B7D5364.86BDB8BC@......
> I'm trying to remove the first 3 characters characters from theupdate mytable
> beginning of a VARCHAR string for a set of records.
set myfield = substring(myfield from 4)
where...
update mytable
set myfield = substr(myfield, 4, 32765)
where...
update mytable
set myfield = substrlen(myfield, 4, 32761)
where...
The bold note is that neither of them work with IB, but with FB:
- substring is the ANSI SQL function implemented in FB.
- substr in IB will return NULL if the end position is greater than the
field's length; FB substr will return from start to end_pos or end of
string, whatever happens first. It seems more sensible.
- substrlen is a variation devised for FB. Instead of working as
(s,begin_pos,end_pos), it works as (s, begin_pos,length).
C.
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase® WebRing