Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
NULL behavior change with SET ENGINEBEHAVIOR
Message
De
11/11/2015 17:00:49
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01627348
Message ID:
01627350
Vues:
41
And I guess SQL Server also returns .NULL. for the SUM() operation since there were no rows to sum?

>>Hi all,
>>
>>Just wanted to confirm this as I could not find anything in the help file.
>>
>>On an old report, SET ENGINEBEHAVOIR was defaulting to 70. A query in the procedure for the report would work fine:
>>
>>
>>
>>dimension laTotals[2]
>>STORE 0 TO laTotals
>>
>>SELECT ;
>>   COUNT(*) AS NumInvoices, SUM(InvoiceTotal) AS Total ;
>>   FROM......WHERE....
>>   INTO ARRAY laTotals
>>
>>
>>If nothing matched the condition, previously the array would not be "touched" and the results would be inserted into a cursor (along with many others). That is, both elements of the array would remain at the default zero.
>>
>>I am now upgrading the report writer and am defaulting to SET ENGINEBEHAVIOR 90. Under this setting, the array is now altered even if no records match the condition. In this case, the array contains:
>>
>>
>>laTotal[1] = 0
>>laTotal[2] = .NULL.
>>
>>
>>So the report failed as the receiving cursor was not set to accept nulls.
>>
>>I could not find anything in the help file about this change with SET ENGINEBEHAVIOR. Just wanted to confirm as I can work around the change but am wondering if there is another "SET" command to easily work around this (with keeping SET ENGINE at 90) or do I have to check all reports that use this old "technique".
>>
>>Albert
>
>This is correct behavior. SQL Server returns 0 as well when where condition returns 0 rows for the COUNT.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform