Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL View from view designer
Message
 
 
À
25/05/1998 13:58:42
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00101710
Message ID:
00101736
Vues:
31
Hi, Kendall

Yes, you've run into a serious limitation (not a bug) of the VD. The problem stems primarily from the fact that the VD insists on using the "nested" join syntax:

JOIN table1 ;
JOIN table2 ;
JOIN table3 ;
ON expression ;
ON expression ;
ON expression

which makes the type of view/query you're trying to do *very* difficult, even programmatically. Better, more intuitive and just as ANSI '92 SQL compliant is the sequential syntax:

JOIN table1 ON expression
JOIN table2 ;
ON expression ;
JOIN table3 ;
ON expression

The solution?

First, if you're working with an updateable view, what are you doing including more than one table? <bg> Seriously, we can get real clever by creating updateable views that update more than one table, or that include fields from more than one table, but why? This is just asking for trouble and confusion IMO. If you follow the rule of "One table per updateable view" then it becomes trivial and the VD can handle it just fine, allowing you to maintain all the stuff like key fields, and updateable fields etc. in the VD. ReadOnly views that are used to display ancillary information or to populate list objects etc., that often include multiple joins and give the VD fits can be "roughed in" in the VD, then the SQL code saved to a .PRG file, even if it doesn't work - you can move stuff around in your VIEWSCRIPT.PRG until it works ok, and it saves you a lot of typing. Because it's a ReadOnly view (SendUpdates is .F.) you don't have to set or maintain all the other properties. Bracket the code in a FUNCTION...ENDFUNC so you can right-click and display the procedures/function list and quickly find the code. This comes in handy when you get a couple hundred views in a DBC <g>.

HTH

>Hi Arnon,
>
>>unfortunetly the View Designer is very limited in its capabilities for creating SQL views
>>I don't use it except for creating very basic views
>>the best option usually is to start with the VD then copy the SQL code into a PRG and continue from there
>>
>
>Thanks for the reply.
>
>I was aware that the view designer had limitations, I just wasn't sure if this was one of them. Apparently it is.
>
>Kendall
>>-Steve->>

Steve Sawyer
Geeks and Gurus, Inc.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform