• I don't see the attachment.

    I'll bet you're working with a table valued function, probably a multi-statement function instead of an inline. Right?

    If so, the optimizer doesn't and can't know what to do with that when it's desiging the execution plan, so it creates a plan for a one row table. That sure sounds like what you're seeing. It's a major reason why the multi-statement UDF is a construct to avoid when you're dealing with sets of data larger than 10's of rows.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning