Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Defaults on views with insert sql gotcha
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Defaults on views with insert sql gotcha
Miscellaneous
Thread ID:
00269189
Message ID:
00269189
Views:
60
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
Reply
Map
View

Click here to load this message in the networking platform