Help with ambiguous term

  • I am working with a dynamic SQL statment that seems to be correct to me.  However, I get "ambiguous column name" in the results pane.  All of the columns are linked to tables (e.g. dbo.customers.tickets).  If anyone can help me with this I would appreciate it.  If you email me I will send you the script for a closer look.

    Marc

    m-sanford@uchicago.edu

  • Try to alias the tables and you'll find your problem easy so solve.

    select MyAlias.mycol,...

    from myschema.myverymeaninglesstablenamefartolongtoread MyAlias

    ...

    if you still cannot find it, post the query.

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Hey, you're short of words today

    Could it be something like this?

    select au_lname from authors a1

    inner join authors a2

    on a1.au_lname = a2.au_lname

    That the above case you'll get the error you described. If you change it to

    select a1.au_lname from authors a1

    inner join authors a2

    on a1.au_lname = a2.au_lname

    the query runs fine. Though my example doesn't make great sense anyway.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • Hey, thanks for your insightful and helpful comments.  I was actually able to solve the problem late last night. 

     

    This forum is great!

     

    Thanks again.

     

    Marc

  • You're welcome

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

Viewing 5 posts - 1 through 5 (of 5 total)

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