🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.vdbase.data.sql
Article #683

Re: Select Character + Numeric

#683
From: Steve Koterski
Date: Mon, 10 Aug 1998 00:00
45 lines
2503 bytes
On Sun, 9 Aug 1998 16:51:11 +0100, "Brian Benson"
<brian.benson@BTInternet.com> wrote:

>
>Geoff S. Wass wrote in message <35CC45CE.8F82A5C8@ibm.net>...
>>Brian,
>>
>>I'm no SQL expert... but I would look at the CAST clause.
>>
>>This is untested:
>>
>>SELECT yourChar || CAST yourNum AS CHAR ....
>>
>>I don't even have my SQL books with me to look this up, so the syntax
>>may not be correct. I hope this points you to a solution.
>>
>Thankyou Geoff,
>
>I have tried various combinations without success.
>I have found the localSQL helpfile and have come to the conclusion that
>although CAST and CHAR are reserved words neither these nor most other SQL
>functions are supported since they do not appear in the helpfile index.
>Perhaps someone more familiar with visual-dBase SQL could comment .

The CAST function and the CHAR data type are both supported by local SQL
(what the BDE uses for dBASE, Paradox, and FoxPro tables). But you have to
use strict syntax, complying with the SQL-92 specification.

To concatenate two values using the Concatenation function (||), both
values must be of CHAR type. The CAST function can be used to convert other
column types (except BLOB and memo) to CHAR for this purpose.

The CAST function takes two parameters: the value to be converted (column,
literal, or calculated value) and the data type to which the value is to be
converted. In the case of the CHAR data type, you *must* supply a length
specification. For example:

  SELECT Name || CAST(NumberField AS CHAR(10))
  FROM YourTable

//////////////////////////////////////////////////////////////////////////
Steve Koterski                      "Knowledge comes, but wisdom lingers."
Technical Publications                -- Alfred, Lord Tennyson (1809-1914)
INPRISE Corporation
http://www.inprise.com/delphi
Technical Details
Message-ID: <35d52c67.8565065@forums.inprise.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6qhdmj$k8r8@forums.borland.com> <35CC45CE.8F82A5C8@ibm.net> <6qkgsd$ofg7@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff5a1,e0ca2689a5358a7a
X-Google-Attributes: gidff5a1,public
From: koterski@NOSPAMborland.com (Steve Koterski)
Subject: Re: Select Character + Numeric
Date: 1998/08/10
Message-ID: <35d52c67.8565065@forums.inprise.com>
X-Deja-AN: 379765053
Content-Transfer-Encoding: 7bit
References: <6qhdmj$k8r8@forums.borland.com> <35CC45CE.8F82A5C8@ibm.net> <6qkgsd$ofg7@forums.borland.com>
Content-Type: text/plain; charset=us-ascii
Organization: INPRISE Corporation, Technical Publications
Mime-Version: 1.0
Reply-To: koterski@NOSPAMborland.com
Newsgroups: borland.public.vdbase.data.sql