'Select top 10 * ...' returns data but 'Select * ..' does not

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • paddymullaney@btopenworld.com

    'Select top 10 * ...' returns data but 'Select * ..' does not

    Hi

    I have a query that is performing very strangely.

    I f I put a top statement in it returns rows,

    so

    Select top 10 * from .......

    returns 10 rows

    but without it then no data is returned

    Select * from ..........

    returns 0 rows.

  • paddymullaney@btopenworld.com

    #2
    Re: 'Select top 10 * ...' returns data but 'Select * ..' does not

    The problem lay in a join to another database on a datatype of
    sqlvariant.

    BOL shows how the sql_variant comparison rules work. I needed to bypass
    these for data in rows after my top 10 list provided.


    I had to use openquery and cast the datatype first to get a join.

    Comment

    Working...