Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread SQL, DB, TBL, FLD
Mon, Feb 4 2008 3:52 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim

I'm working on altering my code generator and I want to make 100% sure I know what is and isn't allowed so if you can correct any mistakes I'd be pleased.

SELECT
DB.TBL.FLD - not allowed
TBL.FLD - ok
alias.FLD - ok
FLD - ok

FROM
DB.TBL - ok
TBL - ok

JOIN
DB.TBL - ok
TBL - ok

GROUP BY
DB.TBL.FLD - not allowed
TBL.FLD - ok
alias.FLD - ok
FLD - ok

ORDER BY
DB.TBL.FLD - not allowed
TBL.FLD - ok
alias.FLD - ok
FLD - ok


Roy Lambert
Mon, Feb 4 2008 3:52 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< I'm working on altering my code generator and I want to make 100% sure I
know what is and isn't allowed so if you can correct any mistakes I'd be
pleased. >>

Here's a simple rule to use in order to remember for DML (SELECT, INSERT,
UPDATE, DELETE):

Table references in the FROM and JOIN clauses - [Database.][Schema.]Table
Column references elsewhere - [Table.]Column  (Table could also be a
correlation name as specified in the statement's FROM clause)

Any other type of DDL operation only permits table and column references,
where applicable.   IOW, if a database reference or name is required
(BACKUP, RESTORE), then of course it can be specified.  However, CREATE
TABLE cannot use a database or schema qualifier.

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Feb 5 2008 2:32 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim


Can the correlation name be surrounded by "?

Roy Lambert
Tue, Feb 5 2008 7:15 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< Can the correlation name be surrounded by "? >>

Yes.  A correlation name for a table or SELECT column is simply a
replacement identifier for the purposes of the current statement.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image