Jim Wright wrote:
> Jochem van Dieten wrote:
>> 
>> The only sensible response is to throw an error because the column name
>> is ambiguous.
>
> IT would seem sensible...but no error occurs (at least in SQL Server..)

But SQL Server shouldn't throw the error when generating the resultset, the 
application that uses the resultset should throw the error. And when we turn MS 
SQL Server into the application using the resultset, for instance by using the 
output of the join as a nested select, it will throw an error:

BEGIN;

  CREATE TABLE thread (
    threadID INTEGER PRIMARY KEY,
    title VARCHAR(10)
    );
  CREATE TABLE message (
    messageID INTEGER PRIMARY KEY,
    threadID INTEGER REFERENCES thread,
    title VARCHAR(10)
    );

  INSERT INTO thread (threadid, title) VALUES (1, 'ttitle');
  INSERT INTO message (messageid, threadid, title) VALUES (1, 1 ,'mtitle');

  -- Should throw an error
  SELECT title
  FROM (
    SELECT *
    FROM thread T INNER JOIN message M ON T.threadID = M.threadID
  ) tmp;

ROLLBACK;

Jochem

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:261020
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to