Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
>>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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement