Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
More problems with the OleDb provider
Message
From
17/09/2006 14:37:50
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01153726
Message ID:
01154483
Views:
19
>>For ease of reading and maintenance I'd recommend using local aliases e.g.
>>
>>SELECT A.Numero, ...
>>FROM Master A ;
>>...
>>
>
>Don't use one letter as table aliases especially first few letters. AFAIK it may produce some unpredictable results...

With regular xBase expressions yes, that's true. You should avoid A through J inclusive as they correspond to the original 10 work areas available in dBASE/FoxBase.

Local aliases in the SQL engine are a different/separate thing entirely. The following code is a "worst-case" scenario that illustrates this:
* Create test tables:
CREATE TABLE TestA ;
	( iValue I )

INSERT INTO TestA ;
	( iValue ) ;
	VALUES ;
		( 1 )

INSERT INTO TestA ;
	( iValue ) ;
	VALUES ;
		( 2 )

CREATE TABLE TestB ;
	( iValue I )

INSERT INTO TestB ;
	( iValue ) ;
	VALUES ;
		( 3 )

INSERT INTO TestB ;
	( iValue ) ;
	VALUES ;
		( 4 )

CLOSE DATABASES ALL

* PURPOSELY open TestA with the regular, xBase alias "A":
USE TestA ALIAS A IN 0

* Use the separate SQL local alias "A" to refer to TestB:
SELECT ;
	A.* ;
	FROM TestB A ;
	INTO CURSOR TestOut

SELECT TestOut
BROWSE
* Result is values 3 & 4
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Reply
Map
View

Click here to load this message in the networking platform