A query

  • I was working on the samples on teh reporting serices when i found this query for adventure works db:

    Select c.firstname, c.lastname, e.title, d.departmentID

    From HumanResources.EmployeeDepartmentHistory D INNER JOIN

    HumanResources.Employee E ON D.EmployeeID = E.EmployeeID INNER JOIN

    Person.Contact C ON E.ContactID = C.ContactID

    Where D.DepartmentID=1

    Order By c.lastname

    However, there are messages reported:

    Msg 4104, Level 16, State 1, Line 1

    The multi-part identifier "c.firstname" could not be bound.

    Msg 4104, Level 16, State 1, Line 1

    The multi-part identifier "c.lastname" could not be bound.

    Msg 4104, Level 16, State 1, Line 1

    The multi-part identifier "e.title" could not be bound.

    Msg 4104, Level 16, State 1, Line 1

    The multi-part identifier "d.departmentID" could not be bound.

    Msg 4104, Level 16, State 1, Line 1

    The multi-part identifier "c.lastname" could not be bound.

    Could you please let me know what went wrong?

  • It looks like your database is configured to be case sensitive. meaning the database is using a case sensitive collation.

    Your query should work if you change your SELECT and ORDER BY clause to exactly match the fields and aliases.

    Something like

    "Select C.FirstName, C.LastName, E.Title, D.DepartmentID ... Order By C.LastName"



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • Hi

    I cannot reproduce this error. I just copied your statement, pasted to SSMS and executed on my AdventureWorks. No errors.

    Greets

    Flo

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply