How to Fetch top %, as read only?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mike Rangel
    New Member
    • Nov 2010
    • 1

    How to Fetch top %, as read only?

    I am trying to write a query that does two things. Can select top 1% or top 100% based on a variable. And two does a dirty read.

    Right now I am doing dirty read with For Fetch ONLY. I want(Think) to add "fetch first 1% rows only for fetch only".

    I was thinking it may be possible to write the query twice as an A and B query with a fetch top 1 and w/o fetch top 1 and having the depending on some variable.
    But I'd rather it be by %

    If var = 1 then
    Select *
    from table1
    Fetch first 1 row
    else
    Select *
    from table1
    end
Working...