Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can you force Integer datatype in query?
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00427622
Message ID:
00427838
Views:
14
>Hi Trey,
>>>This particular SQL Query is generated out of FoxFire! So far I haven't come up with a better way. Performance hasn't been an issue for this UDF. I do avoid them where possible. Haven't come up with a good iif() for Age, yet. I've watched the Age threads recently, BTW.
>>>
>>
>>>Too bad VFP doesn't have the Convert() function like SQLServer.
>>
>>Where would you use the Convert() if you could? In the SELECT statement?
>>If so, you could still return .NULL. from Get_Age() but use Nadya's idea of 1000 in the SELECT by using the NVL() function. e.g.
>>
>>SELECT NVL(Get_Age(), 1000) As age, ....
>
>SELECT CONVERT(smallint, Get_Age()) ...
>
>That way I could still have NULL as the result. i.e. an Integer NULL.
>

Numeric v. integer shouldn't make any difference for nullability of a field in a SELECT. I bet the first record returned is getting a NULL from Get_Age() - I ran several tests, and never got a problem unless the first result record was getting the NULL - the rest of the records that got NULL were NULL. It was a numeric field, and a DISPLAY STRUCTURE showed it as not nullable.

>I may end up using nvl() to convert that NULL to -999 or something...

I was just about to follow up my last post with the same suggestion - to use a negative number instead of a high number - I mean, you never know if Mel Brooks might be entered in the database <g>
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