Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL 7.0 not converting Money fields properly
Message
De
02/04/2001 09:54:35
 
 
À
30/03/2001 19:17:43
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00490504
Message ID:
00490912
Vues:
13
>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform