Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Command contains unrecog phrase/keyword on SQL
Message
From
10/01/2009 12:45:11
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01372085
Message ID:
01372554
Views:
19
>DO'OH!
>
>I knew it was one of those "Can't see the wood for the trees" occasions.
>
>I've scrutinized each line and STILL didn't spot it. I know how it happened. I copied the select clause from a similar SQL, and deleted the last line for this, but forgot the comma.
>
>Well done you eagle-eyed people.

Eagle eyed? Yeah, right... it's just an illusion. I've spotted it right away simply because the same thing bit me dozens of times. Which is why I use Fabio's syntax, which is far easier:
select field1;
   ,   field2 ;
   ,   field3 ;
   ,   field4 ;
   ,   field5 ;
...
The trouble with SQL syntax is that for 100 fields you have 99 commas. And you need to take care to omit the last one - and the end of the field list is the place where you're most likely to add stuff, so you have to take that care each time, and of course you'll forget once in a while. And since it doesn't happen every day, when it happens, you don't remember what it is.

I like Fabio's syntax because the oddball field (without the comma) is the first one, but it somehow balances out by having the word "select" to it. And since it's the first field, it's very unlikely it will ever change. The rest of the fields may, at any time. I've also found that this way I can copy and paste fields from one SQL statement to another with far more ease (because I copy whole lines, and don't have to remember whether I started from a comma or from the space after the comma or from the first character of my fields, and likewise - how far did I select to copy). Of course, if I add more lines from elsewhere, I don't have to check for that last comma, because it simply isn't there.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform