Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Defaults on views with insert sql gotcha
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Defaults on views with insert sql gotcha
Divers
Thread ID:
00269189
Message ID:
00269189
Vues:
59
I found an interesting situation using VFP 6.0 SP3 and defaults on views.
If your defaults on a view are different to your table and you issue an insert sql statement and forget to (like I did) add all the fields that have defaults set into the insert command and write the record back the defaults that are set on the table are written instead of defaults on the view.

The above works fine if you issue an append blank.

Making the defaults the same on the table as the view works also.
When you look at the contents of the view the defaults seem to be set correctly. When you issue a tableupdate however the defaults from the table get written instead.

if there are no defaults on the table then it will place null values to the fields.

I fixed the problem by correctly adding all the fields to the insert statement, but I got a scare!

Any comments
Wayne Williams
Developer VFP
Répondre
Fil
Voir

Click here to load this message in the networking platform