Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Unexplained value in SQL field
Message
From
09/10/2006 14:31:35
 
 
To
09/10/2006 13:22:05
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01160578
Message ID:
01160668
Views:
8
>>Sounds correct - but you also should make sure you CAST on the outside *or* data drive the type to cast into. Otherwise a DB schema change to "C(5)" could create some new problems since the .null. would return another data type.
>
>Could you provide an example on what you mean? I am not sur I understand exactly what you mean.

If you are on the vfp-backend side have in your schema
Member.NoSchool N(6)
and hardcode your SQL as nvl(Member.NoSchool, CAST(0 as N(6,0)) you could get problems if you change your schema to
Member.NoSchool N(9)
you will get overflows again, if you by any chance change into
Member.NoSchool C(12)
you will return a wrong type. CAst(nvl(Member.NoSchool, 0) as N(6)) at least will guarantee the same field type in the resulting cursor, but you can run into overflows from the changed field type N(9). But if you datadrive like
lcCast = " CAst(nvl(Member.NoSchool, 0) as " + Type("Member.NoSchool") + "(" + Fsize("NoSchool", "Member") + ")"
or go via afields() for decimal places as well you can change your DB schema without worry.

regards

thomas
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform