tags:

views:

96

answers:

1
SELECT
       (SELECT Grade
       FROM  DB2..Students
       WHERE   DB2..Students.studentnumber=DB1..Students.studentnumber             
          AND  ISNULL(Students.Disable,'')  != 'T'
    )  as test,* from DB2..Students

WHERE  studentnumber IN
       ( SELECT studentnumber FROM DB2..Students where     
           AND ISNULL(studentnumber,'') !=''
       AND ISNULL(Students.Disable,'')     != 'T'
)

What's wrong?

I am getting an error: "The multi-part identifier "DB1..Students.studentnumber" could not be bound."

Please help
Thanks

+1  A: 

You appear to be using two tables named "Students". One in DB1 and one in DB2. You are referencing DB1..Students in your WHERE clause, but not in your FROM clause.

Rodrigo Sieiro
Yes..I didn't form the query in a proper way. Thanks a lot!
Mithil Deshmukh
Good catch. I never realized that <db>..<table> works fine with the dbo schema.
JamesMLV