How to limit record count using a parameter

  • Hello:

    I'm familiar with the TOP command and that works fine to limit my record count, using a fixed value. However, I can't get it to work if I try to use it as a parameter. Ultimately this will be a parameter chosen in SSRS, but I 'think' it's more of a query thing than a SSRS thing.

    SSRS response: "must declare the scalar variable..."

    Any ideas?

    select top (@Limiter) *

    from myTable

    thanks

  • Please don't cross post. It just wastes peoples time and fragments replies.

    No replies to this thread please. Direct replies to: http://www.sqlservercentral.com/Forums/Topic685708-338-1.aspx

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

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

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