Board index » delphi » CAST in Local SQL? SQL Help needed

CAST in Local SQL? SQL Help needed

I need to combine a couple of fields into one column and the are
different types (Numeric and string) Like Street_Number + Street_Name
= Street_Address.

In this example Street_Number is numeric, Street_Name is a character
field and the concantonated result is Street_Address.

How can I do this in Local SQL?

Thanks to anyone who can help...

Bill
b...@droste1.com

 

Re:CAST in Local SQL? SQL Help needed


On 29 Jul 1999 16:12:49 -0500, b...@droste1.com (Bill Artemik) wrote:

Quote
>I need to combine a couple of fields into one column and the are
>different types (Numeric and string) Like Street_Number + Street_Name
>= Street_Address.

>In this example Street_Number is numeric, Street_Name is a character
>field and the concantonated result is Street_Address.

>How can I do this in Local SQL?

Two functions need to be used. First, the CAST function would be used to
convert the numeric data to CHAR. Then, the concatenation function (||)
would be used to concatenate the converted value to the string value. For
example:

  SELECT CAST(Street_Number AS CHAR(10)) || Street_Name
  FROM YourTable

Local SQL (what the BDE uses for dBASE, Paradox, and FoxPro tables) is
documented in the online help file LOCALSQL.HLP, found in the main BDE
directory. This help file is a language reference of the local SQL
implementation (subset) of SQL-92. The copy of this file that came with BDE
4.x (and earlier versions) was outdated and has since been rewritten.
Updated copies will have the topic "Unsupported language" in the index (and
lack of this topic indicates a pre-update copy). I can e-mail you a copy of
the updated file if you need and desire it.

Both the CAST and concatenation functions are discussed in this help file,
in dedicated toppics. Each topic has at least one source example
demonstrating its use.

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Steve Koterski         "Television is a medium because anything well done
Felton, CA             is rare."
                                                 -- Fred Allen (1894-1956)

Other Threads