Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Decimal places
Message
De
25/02/2015 15:37:25
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01615791
Message ID:
01615836
Vues:
33
Thanks!

>Use CAST() function
>
>>
>>What determines the length of a calculated numeric field in SQL? In the following example I was expecting no decimal places, since the calculated field in the first record was 0. However, lo and behold, the structure is N(10, 4). Where did the SQL get that?
>>
>>I used this test because in the real environment I was getting either '0' or '*' in all the records and I was trying to figure out a way to 'force' a N(10, 5).
>>
>>
>>SQL Code
>>SELECT *, num1/num2 num3 ;
>>FROM test ;
>>INTO CURSOR curtest
>>
>>Table Test structure
>>Num1  3, 0
>>Num2  3, 0
>>
>>CurTest Structure
>>Num1  3, 0
>>Num2  3, 0
>>Num3  10, 4
>>
>>Data in Test
>>Num1    Num2
>>0            4
>>500        49
>>500        3
>>
>>Data in curTest
>>Num1    Num2   Num3
>>0            4             0.0000
>>500        49           1.0020
>>500        3          166.6667
>>
>>
>>Thanks,
>>
>>Yossi
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform