Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Decimal places
Message
From
24/02/2015 13:21:08
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
SQL Decimal places
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01615791
Message ID:
01615791
Views:
55
Hi All:

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
Next
Reply
Map
View

Click here to load this message in the networking platform