Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Data Types & SQL SELECTS
Message
De
12/05/1999 10:16:29
 
 
À
12/05/1999 08:34:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00217513
Message ID:
00217816
Vues:
12
>>I have a table with character values and I want
>>to extract them as integers.
>>
>>I'm basically doing something like
>>SELECT VAL( Col1) AS FstCol, VAL( Col2) AS SecCol ;
>> FROM TEST1 ;
>> INTO TEST2
>>
>>Is there a way of controling the data type of
>>a column with SQL SELECTs?
>>
>> ...kt
>something like
>
>select 000000.00 as FstCol...
>union ;
>SELECT VAL( Col1) AS FstCol, VAL( Col2) AS SecCol ;
> FROM TEST1 ;
> INTO TEST2
>
>Arnon

Arnon, you were just about there. This is what
I did which works well on my little 100 record
test file:

CREATE CURSOR junk ( Fld1 I, Fld2 I, Fld3 I)
SELECT junk.* FROM junk ;
UNION SELECT RECNO() AS Fld1 ;
, VAL( Fld2) ;
, VAL( Fld3) ;
FROM dmiProv ;
INTO TABLE TEST2

The resulting table will have the field
sizes AND NAMES from the first table
SELECTed and the values from the second.
It was also about half the size of the
table without the new trick.

What I found interesting (which you guys
pro'ly already knew) was that the I did

SELECT RECNO() AS Fld1 ;
, VAL( Fld2) ;
, VAL( Fld3) ;
FROM dmiProv ;
INTO TABLE TEST1

- OR -

SELECT RECNO() AS Fld1 ;
, Fld2 ;
, Fld3 ;
FROM dmiProv ;
INTO TABLE TEST2

Test1 and Test2 file sizes are exactly the same.

Perhaps not fascinating, but interesting :-)

Thanx guys.

...kt
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform