Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to change field name in SQL Select
Message
From
20/12/2012 11:56:27
Thomas Ganss (Online)
Main Trend
Frankfurt, Germany
 
 
To
20/12/2012 10:14:38
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Pro
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01560255
Message ID:
01560308
Views:
62
Hi Mike,

technically of course correct, but still faster ***in SQL*** than eval() or getpem(),
as it is expanded only once per SQL statement.
If the SQL statement is so long that marcoexpansion matters there are probably other issues.

As long as the SQL is not run in a tight loop,
doing that for perf reasons is premature optimization IMO.
As a matter of personal preference it is more readable,
whereas sometimes I prefer to tweak makros in the debugger.


regards

thomas

>
>I tend to construct SQL using TEXT...ENDTEXT. If you're going to use & to 'expand' the fieldname, you may require many in larger SQL. & is slow. TEXT...ENDTEXT lets you do a lot of expanding without a lot of programming and you only use the & once.
>
>
TEXT TO lcCmd TEXTMERGE NOSHOW
>Select code, department, month1 as <<"_"+dtos(DATE()) >> ;
> from File1;
>into cursor file2
>ENDTEXT
>&lcCmd
>  
>BROWSE NORMAL
Previous
Reply
Map
View

Click here to load this message in the networking platform