General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
>>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only