Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL 7.0 not converting Money fields properly
Message
From
02/04/2001 09:54:35
 
 
To
30/03/2001 19:17:43
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00490504
Message ID:
00490912
Views:
14
>We have set up remote views into SQL 7.0 tables and it converting our Money fields to Currency 8,4. What can we do about this.
>
>TIA

What should it be converting it to? Money type in SQL Server maps to Currency type in VFP.
You can change the definition of your datatype in the view. e.g., if you want it to be N(18,2)

DBSETPROP("MyView.CurrencyField", "Field", "Datatype", "N(18,2)")

You can easily do this programmatically for all views with this:
Open Database mydatabase
Select d1.objectname as viewname, d2.objectname as fieldname ;
  From DBC() d1 ;
  Join DBC() d2 ;
  On d1.objectid = d2.parentid ;
  And d1.objecttype= "View" ;  
  Where IIf(d1.objecttype = "View", ;
            DBGetProp(Alltrim(d1.objectname), "View", "SourceType") = 2, ;
            .F.) ;
  And IIf(d2.objecttype = "Field", ;
            DBGetProp(d1.objectname-'.'-Alltrim(d2.objectname), "Field", "Datatype") = "Y", ;
            .F.) ;
  Into Cursor cuViewField

Scan
  DBSetProp(viewname-"."-Alltrim(fieldname), "Field", "Datatype", "N(18,2)")
EndScan
Insanity: Doing the same thing over and over and expecting different results.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform