SQL And Operating System

Posts   
 
    
mohamed avatar
mohamed
User
Posts: 136
Joined: 10-Mar-2008
# Posted on: 03-Dec-2008 12:50:35   

I want to ask Does the behavior of SQL engine change wlth changing Operating System ??

let me put this case !!!

i have Table Named table1 and has 3 column c1, c2, c3

and wanting to run just simple query like


  Select c1,c1
  from table1
  order by c1

when run this query on WinXP, Win2003 server with SQL 2000,2005 it works on Win Vista,Win 2008 Server with SQL 2000, 2005, 2008 it fails The reason of flailing is "Ambiguous column name 'c1'."

I know if i put ails it works but i have vb application already written by this way

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39797
Joined: 17-Aug-2003
# Posted on: 03-Dec-2008 14:11:30   

The error is caused by the order by. if there are 0 rows to return, the error won't pop up because orderby runs after the projection. If there are 1 or more rows, you'll see this error.

i.o.w.: change your query, it's incorrect wink

Frans Bouma | Lead developer LLBLGen Pro
mohamed avatar
mohamed
User
Posts: 136
Joined: 10-Mar-2008
# Posted on: 03-Dec-2008 14:23:54   

The error is caused by the order by. if there are 0 rows to return, the error won't pop up because orderby runs after the projection. If there are 1 or more rows, you'll see this error.

on xp ,2003 server i try it in empty table with no errors

but still on Vista and 2008 server it throw Ambiguous column name 'c1'.