If you're talking about SQL code for VFP tables, then use CAST (VFP 9.0) to get the result with desired number of decimals.
For SQL Server the rules are quite interesting and complex. You may find my article on this helpful:
http://social.technet.microsoft.com/wiki/contents/articles/17910.how-sql-server-determines-type-of-the-constant.aspx>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
If it's not broken, fix it until it is.
My Blog