Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2004
    Posts
    8

    Cool Unanswered: The column prefix 'h' does not match with a table name or alias name used in the que

    Hi Guys,

    I have a program that connects to SQLServer 2000 through ADO connection.

    the program executes the following query:

    SELECT ax.AccNo,
    (SELECT Accounts.ProductCode FROM Accounts WHERE h.ID=Accounts.ID) As Product
    FROM dbo.History h LEFT OUTER JOIN dbo.AccXRef ax ON h.ID= ax.ID LEFT OUTER JOIN dbo.States ON h.[HistoryItemsub-Type] = dbo.States.Type LEFT OUTER JOIN dbo.CustXRef cx ON h.CustomerNo = cx.CustomerNo
    WHERE HistoryItemDate <= getdate() ORDER BY HistoryItemDate ASC



    This query works in th program and in Query Analyer on my machine.
    However, On a different Machine (and different SQLServer) the query works in Query Analyser but does not work in the program, the following exception is thrown:

    The column prefix 'h' does not match with a table name or alias name used in the query


    Any help is greatly appreciated..

    thanx in-advance,

    TNT

  2. #2
    Join Date
    Feb 2004
    Posts
    492

    Re: The column prefix 'h' does not match with a table name or alias name used in the

    Why not join the accounts-table as you do with the others?

  3. #3
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Current MDAC ???

    -PatP

  4. #4
    Join Date
    Mar 2004
    Posts
    8

    Talking

    Kaiowas & Pat Phelan,

    Thanx for replying..

    MDAC Version 2.8 RTM.

    i will restructure the query as Kaiowas suggested...

    still curious though ??

    Many thanx ...

    TNT.

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I'd be inclined to reload the MDAC onto the offending machine. Something smells bad to me there, and it can't hurt.

    -PatP

  6. #6
    Join Date
    Mar 2004
    Posts
    8

    Cool

    Originally posted by Pat Phelan
    I'd be inclined to reload the MDAC onto the offending machine. Something smells bad to me there, and it can't hurt.

    -PatP
    The offending Machine has:
    > MDAC Version 2.6 SP2 (2.62.7926.1)
    > SQL Server is 2000 SP2 + MS02-056/61


    Are these a problem ??

    TNT

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •