Article View: borland.public.intrabuilder.data.sql
Article #79Re: Concatenation of strings and numerical-values in SQL
From: Ken Mayer [TeamB]
Date: Tue, 28 Jul 1998 00:00
Date: Tue, 28 Jul 1998 00:00
41 lines
1950 bytes
1950 bytes
"Werner Renhardt" <werner@kangaroo.nwy.at> wrote:
>Concatenation of strings and numerical-values in SQL:
Can't do it. SQL doesn't allow it.
> Auto-Conversion of numerical values to strings does not work. )
It does this in IntraBuilder only when using IntraBuilder specific
commands.
> How can I cast the numerical value 'TabID' to a String-value?
> I've found no function (e.g. Str(<Number>))
> I've found no operator (e.g. & (Ampersand) in ACCESS which implicit
> casts numerical values to Strings)
> There is no hint in the 'Localsql.hlp' of BDE
> and the IntraBuilder-Helpfile
Rather than using SQL to do this, try creating a calculated field in
the rowset using a query object:
// note that the following is untested and taken from somewhere else:
q = new query();
q.sql = "select * from mytable";
f = new Field();
f.fieldName = "My Calculated Field";
// note: this will fire for each row ...
// "this" refers to the field, "parent" is the fields
// array ... (substitute 'field1' with the name of the
// field, and of course, you would want to set your
// calculation for what you need
f.beforeGetValue = {|| this.parent["numfield"].value +
this.parent["charfield"].value };
q.rowset.fields.add( f );
q.active = true;
Ken
---
Ken Mayer [TeamB]
Golden Stag Productions
http://www.mindspring.com/~hirschv/homepage.htm
http://www.mindspring.com/~hirschv/dbase/dbase.htm
Technical Details
Message-ID:
<35bd1842.1934292@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6pi5lo$94113@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 101d9a,7fe303948be618ed X-Google-Attributes: gid101d9a,public From: supportInfo@borland.com (Ken Mayer [TeamB]) Subject: Re: Concatenation of strings and numerical-values in SQL Date: 1998/07/28 Message-ID: <35bd1842.1934292@forums.borland.com> X-Deja-AN: 375495256 References: <6pi5lo$94113@forums.borland.com> Organization: Golden Stag Productions Reply-To: teamb@opto-pps.com Newsgroups: borland.public.intrabuilder.data.sql