[thelist] MS SQL Syntax Help

Joshua Olson joshua at waetech.com
Tue Apr 16 12:52:01 CDT 2002


----- Original Message -----
From: "Judah McAuley" <judah at wiredotter.com>
Sent: Tuesday, April 16, 2002 1:29 PM
Subject: Re: [thelist] MS SQL Syntax Help

> I don't see why that syntax should work anywhere since a select returns
> a recordset, not a table.  I had a similar problem where I wanted to
> create a full-text index on a view, but I couldn't because a view is a
> recordset not a table.

Judah,

According to SQL-92, you should be able to do this:

http://www.netaktive.com/biblio/sql/SQL98/sql2bnf.aug92.txt

Below I've included the parts of the spec that make me think this should be
possible.

<query specification> ::=
    SELECT [ <set quantifier> ] <select list> <table expression>

<table expression> ::=
    <from clause>
    [ <where clause> ]
    [ <group by clause> ]
    [ <having clause>

<from clause> ::= FROM <table reference>
    [ { <comma> <table reference> }... ]

<table reference> ::=
      <table name> [ [ AS ] <correlation name>
          [ <left paren> <derived column list> <right paren> ] ]
    | <derived table> [ AS ] <correlation name>
          [ <left paren> <derived column list> <right paren> ]
    | <joined table>

<derived table> ::= <table subquery>

<table subquery> ::= <subquery>

<subquery> ::= <left paren> <query expression> <right paren>

<query expression> branches out into the different types of joins, but
eventually rolls back to <query specification>, which is where we started.
IOW, this syntax is Okay at least as far as SQL-92 is concerned.

:)

-joshua

<tip type="SQL Syntax" author="Joshua Olson">
The following link has links to the syntax specifications for SQL.

http://www.netaktive.com/biblio/sql/SQL98/sqlref.htm
</tip>





More information about the thelist mailing list