Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select with additional conditions
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01268865
Message ID:
01269480
Views:
10
>>>>>>>Is that correct? I thought that SQL aliases have nothing to do with A-J aliases for work areas.
>>>>>>>
>>>>>>>>It's a bad idea to use one leter meaningless table aliases in a query. It makes the query totally unreadable. It also could be dangerous because letters A-J are reserved for workareas 1-10.
>>>>>>
>>>>>>From my testing, you are correct: Message#1154483
>>>>>
>>>>>It's no longer a problem, but at one time, you could get unexpected results with something along these lines:
>>>>>
>>>>>
>>>>>SELECT 1
>>>>>USE MyTable && now in workarea A
>>>>>
>>>>>SELECT ... ;
>>>>>  FROM AnotherTable A ;
>>>>>  ...
>>>>>
>>>>>
>>>>>VFP would get confused over what A meant.
>>>>>
>>>>>Tamar
>>>>
>>>>What was that time?
>>>>In my experience, (V)FP was NEVER confused in the scenario above. Maybe the programmer, but that's always a possibility.
>>>
>>>My example may be too simple, but I definitely saw cases where the use of single letter aliases in queries caused a problem.
>>>
>>>Tamar
>>
>>I definitely saw them in the past with earlier versions of VFP. I simply stopped using single letter aliases in SQL statements a long time ago, so I couldn't tell you if it's still a problem or not. But it certainly did exist.
>
>
>Fred and Tamar,
>I'd really like to see a case when you assign a one letter alias in an SQL, and SQL gets "confused".
>I have FPD/FPW/VFP5/VFP9 installed, so in case you no longer have them, I can test your scenarios.
>
>I am NOT talking about coding mistakes, i.e. reference one letter aliases that were not assigned in the SQL statement. FWIW, if you reference an alias that is not assigned in the SQL the behavior changed from FPD/FPW to VFP5/9:
>- In FPD/FPW you get an error, regardless of having or not having a file open in that work area.
>- In VFP5/9 you don't get an error if there is a file open in the work area. So, yes, you could see this as a trap in which it is easier to fall with one letter aliases, but it is still a simple case of coding mistakes, not a mysterious behavior.
>
>I am not advocating using one letter aliases here, just saying that SQL is not confused by them.

Like I said, I no longer use one letter aliases in SQL SELECT statements and it was probably VFP5 or maybe even FPD/W 2.5 or 2.6. I can't remember a scenario that fails. It's still not a good idea to use them because A-J,M is considered "reserved", so why take the chance. YMMV
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform