Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Any side effects in allowing NULL?
Message
De
30/03/2012 08:47:30
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01539772
Message ID:
01539773
Vues:
99
>Now that I have a couple of customers using my VFP application with SQL Server database I ran (once in a while) into a problem with NULLs. Here is what happens. In many places in the program the code creates an empty cursor. And then this cursor is populated from other cursors retrieved from SQL Server. And when adding a record to the initial empty cursor and a value happens to be NULL, the program bombs with an error (column COLNAME does not allow NULLS). In order to eliminate this issue I am thinking of always specifying/allowing NULL for every column of the empty cursor. Just in case. Will it slow down the processing of this cursor? The cursor usually is not very big, maybe up to 2000 records. What do you think? TIA.

I think the default in SQL Server, when you create a new field is to allow nulls. But, there are two thinking about that. I am one of them who make sure to avoid null everywhere. Some others want to support it so they know the field hasn' been touched since its creation, if it is null. But, they then have to code against it to make sure the situation you had does not happen. As for me, when I create a new record, I have default values for empty fields, so I do not get any null. The only one that I need to support it is the Geography spatial data type which I can only have that value or a spatial data type value.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform