smithmrk
asked on
FoxPro Alias Table Name
Hello Experts!
How can I shorten the name of a table?
For Example:
SELECT *;
FROM Long_Table_Name LTN;
In SQL you can just put a space and then LTN for the short name, how do you do this in FoxPro?
Thanks,
Mark
How can I shorten the name of a table?
For Example:
SELECT *;
FROM Long_Table_Name LTN;
In SQL you can just put a space and then LTN for the short name, how do you do this in FoxPro?
Thanks,
Mark
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Besides USE ALIAS you can also use alias namesin SQL, as you initially wrote, with or without AS keyword:
Besides M you should also aviod a-j as those are reserved for workarea 1 to 10 for historical reasons (backward compatibility with 2.x versions, if not even older).
Bye, Olaf.
SELECT LTN.fieldx, ATN.fieldy;
FROM Long_Table_Name LTN ;
LEFT JOIN Another_Table_Name AS ATN;
ON LTN.id = ATN.LTNid
Besides M you should also aviod a-j as those are reserved for workarea 1 to 10 for historical reasons (backward compatibility with 2.x versions, if not even older).
Bye, Olaf.
ASKER
Thanks for the additional information Olaf!
Mark
Mark
You're welcome.
Another hint: If you're having problem with a query length, especially the WHERE clause: take a look at SYS(3055)
http://msdn.microsoft.com/en-us/library/43cab295(v=vs.80).aspx
Bye, Olaf.
Another hint: If you're having problem with a query length, especially the WHERE clause: take a look at SYS(3055)
http://msdn.microsoft.com/en-us/library/43cab295(v=vs.80).aspx
Bye, Olaf.
Just to clarify: Local (short) aliases a - j can be used in SQL commands without restrictions. The local alias has precedence to any other language element and historical reasons cannot apply here. Alias m can also be used in SQL commands but then you cannot distinguish between table (aliased as m) column and memory variable of the same name.
FoxPro has no reserved keywords and you may use language elements as variable and column names almost freely (with some restrictions and surprises, of course)... Variables a - j do not cause any problems.
SYS(3055) can be useful but I did not use it yet - my SQL commands are too short probably. But to overview the list of available FoxPro functions is geed practice. :-)
FoxPro has no reserved keywords and you may use language elements as variable and column names almost freely (with some restrictions and surprises, of course)... Variables a - j do not cause any problems.
SYS(3055) can be useful but I did not use it yet - my SQL commands are too short probably. But to overview the list of available FoxPro functions is geed practice. :-)
ASKER
WOW, Thanks for all the Information!
I really appreciate the knowledge you folks have as I try to be a better programmer!
Thanks again for all your help in the past, now, and defiently in the future!
Mark
I really appreciate the knowledge you folks have as I try to be a better programmer!
Thanks again for all your help in the past, now, and defiently in the future!
Mark
ASKER