[thelist] Beautiful SQL Syntax (was: SQL Madness!)

Joel D Canfield joel at spinhead.com
Fri Aug 17 18:22:00 CDT 2001


Joe:

Here's how I do it (on those rare occasions when I manage:)

Write the VBScript w/o SQL. Write in the SQL with real values instead of VBS
variables. Now, go back and replace the real values with the variables -
each will be double-quote and ampersand and variable and ampersand and
double quote.

If there were single quotes there as part of the SQL, leave 'em. Where you
have your semicolons, your DSN string (if you're using such) just leave 'em
as is. I've found it's much easier to visualize one phase at a time than to
try to write VBS and SQL at the same time.

joel at spinhead.com

-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of Joe Crawford
Sent: Friday, August 17, 2001 3:04 PM
To: thelist at lists.evolt.org
Subject: [thelist] Beautiful SQL Syntax (was: SQL Madness!)


matthew garrett wrote:
> Have I been sleeping? I can't remember seeing such an elegantly formatted
> SELECT clause. Makes it pretty easy to spot the missing commas, yes?
>
> > From: "rudy" <r937 at interlog.com>
>
> > SELECT category.url_path AS category_url_path
> > , category.name AS category_name
> > , event.id
> > , event.name
> > , event.introduction
> > , event.is_active
> > , event.date_begin
>
> Thanks Rudy - nice tip.


http://rudy.ca writes absolutely beautiful SQL. I love the commas in
front thing. On a local San Diego list I posted a sample of my own code
which uses the "rudy style" and a pal commented to me that it was a
great innovation.

Indeed - good stuff, and far superior to how I was doing it before (in
big long lines -UGH!).

Here's a question - I'm just starting to touch ASP - how does one keep
the SQL crystal clear when doing ASP? Seems like things get messy when
writing that VBScript. But this may be a function of my newbieness with
it.

	- Joe <http://artlung.com/>






More information about the thelist mailing list