Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Mdot gotcha with SQL alias M
Message
De
08/07/2010 15:33:09
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
08/07/2010 13:31:14
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01471907
Message ID:
01471917
Vues:
68
>Hi all
>
>Here's an interesting problem I found in an application I inherited.
>
>I strongly advise against single letter aliases in SQL and in VFP from the perspective of readability and maintainability. Be especially careful with M as an alias in VFP SQL.
>
>create table tmpinvoices free (field1 c(10))
>local ltDatetime
>ltDatetime = datetime()
>select m.field1,m.ltDatetime as tdatetime from tmpinvoices m into cursor c_Result
>
>You will get an error that column ltDatetime is not found. OK. So drop the m. from ltDatetime, but now you are slowing your query - admittedly very little, but I don't like doing things half-fast. ;)
>
>I tried to add this to the mdot topic on the wiki, but my changes are not being saved.

Single letter aliases are OK. M is a special reserved "alias" for memory variables. Simply use another local alias for your table and m. for the memory variable.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform