Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a way to determine if field contains NULL or no
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00567112
Message ID:
00567146
Views:
18
Sergey,

This whole idea started from the following. My colleague wrote a DeNull program. This programs opens table exclusively and if field allows NULLs, changes it to not allow them. It doesn't check, whether file contains NULLs or not. First of all, this process may be slow on the huge files. Secondly, all of the sudden I had VFP crash today several times when it was running this program. It worked just fine few days ago, so I had no idea, what may cause this crash...


Wait a minute! I think this file doesn't contain records, so ALTER table may cause crash. I'll check...
>>Hi everybody,
>>
>>Suppose, you have a file with 20000 records. Is there a way to check, if field contains NULLs or not for the whole file except for scanning through it and check each field, which would be time consuming...
>>
>>I just thought about another idea: select sum(iif(isnull(field1,1,0)) as Field1NullsCnt, etc.
>> but it would be slow too...
>>
>>Do you have other suggestions?
>
>
SELECT COUNT(*) As TotalRec, COUNT(filed1) As NotNullRec ...
>or
>SELECT COUNT(*) - COUNT(filed1) As NullRecCnt ...
This way you can even count nulls in more than one column.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform