 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Al Vas Guest
|
Posted: Fri Oct 24, 2003 6:34 am Post subject: SUBSTRING command |
|
|
Hi,
I want to create an SQL calculated field that does the following:
(SUBSTRING(Code FROM 1 FOR 3) = 'SUP')
In other words I am assigning it as a Boolean type, True or False, but I am
getting an error token '=' is not valid. Is this not allowed in LocalSQL,
and if not is there a way to do this calculation?
Thanks
Alex
|
|
| Back to top |
|
 |
Richard Biffl Guest
|
Posted: Fri Oct 24, 2003 7:03 am Post subject: Re: SUBSTRING command |
|
|
That should work in LocalSQL. Are you using an old version of the BDE? Use
5.11 or later.
Richard
"Al Vas" <alex (AT) au (DOT) com.favour> wrote
| Quote: | I want to create an SQL calculated field that does the following:
(SUBSTRING(Code FROM 1 FOR 3) = 'SUP')
In other words I am assigning it as a Boolean type, True or False, but I
am
getting an error token '=' is not valid. Is this not allowed in LocalSQL,
and if not is there a way to do this calculation?
|
|
|
| Back to top |
|
 |
mkm Guest
|
Posted: Sat Oct 25, 2003 7:58 pm Post subject: Re: SUBSTRING command |
|
|
It's not allowed in LocalSQL.
Try this:
SELECT
CAST('true' AS BOOLEAN)
FROM
"table.db"
WHERE
(SUBSTRING(Code FROM 1 FOR 3) = 'SUP')
UNION ALL
SELECT
CAST('false' AS BOOLEAN)
FROM
"table.db"
WHERE
(SUBSTRING(Code FROM 1 FOR 3) = 'SUP')
"Al Vas" <alex (AT) au (DOT) com.favour> wrote
| Quote: | Hi,
I want to create an SQL calculated field that does the following:
(SUBSTRING(Code FROM 1 FOR 3) = 'SUP')
In other words I am assigning it as a Boolean type, True or False, but I
am
getting an error token '=' is not valid. Is this not allowed in LocalSQL,
and if not is there a way to do this calculation?
Thanks
Alex
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|