openquery giving differnt results

Posted by Mithil Deshmukh on Stack Overflow See other posts from Stack Overflow or by Mithil Deshmukh
Published on 2009-08-04T22:02:38Z Indexed on 2010/03/12 7:07 UTC
Read the original article Hit count: 249

Filed under:
|

I have 2 similar queries

select * 
from openquery(powerschool, 
                'select * 
                 from TEACHERS 
                 where teachernumber is not null 
                   and schoolid=''1050'' 
                   and teacherloginid is not null  
                 order by teachernumber')

and

SELECT * 
from openquery(powerschool, 
              'SELECT NVL(teachernumber,'''') 
               from TEACHERS 
               where teachernumber is not null 
                 and schoolid=''1050'' 
                 and teacherloginid is not null 
               order by teachernumber')

The first one is giving me 182 rows while the second one gives me 83. What's wrong with the queries?

© Stack Overflow or respective owner

Related posts about sql

Related posts about odbc