Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data Types & SQL SELECTS
Message
From
12/05/1999 10:16:29
 
 
To
12/05/1999 08:34:33
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00217513
Message ID:
00217816
Views:
14
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform