BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SUBSTRING command

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop)
View previous topic :: View next topic  
Author Message
Al Vas
Guest





PostPosted: Fri Oct 24, 2003 6:34 am    Post subject: SUBSTRING command Reply with 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
Richard Biffl
Guest





PostPosted: Fri Oct 24, 2003 7:03 am    Post subject: Re: SUBSTRING command Reply with quote



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





PostPosted: Sat Oct 25, 2003 7:58 pm    Post subject: Re: SUBSTRING command Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.