title: Stop executing the select statement when first matching record found in SQL Server
body: <p>In a select statement I call function and this function returns % value (calculate percentage) in terms of integer. My requirement is to stop executing the query when the first percentage match to 90%.</p>
  
  <p>Please find below query.</p>
  
  <pre><code>Select Name, Calculatepercentage(Name) 
  from emp
  </code></pre>
  
  <p>In the above query, <code>Calculatepercentage</code> is the function and it will return % value in terms of integer.</p>
  
  <p>Let us says in emp table I have 100 records and out of 100, 30 records marks percentage are >= 90.</p>
  
  <p>I want to stop the query when first matching found. Let us assume at 15th record we found marks percentage 91, then stop to executing query at 15th record.</p>
  
  <p>I can do this task by looping all 100 records and when first matching record found I can skip the loop. But it takes lot of time to execute the query.  In that loop we need to call function 100 times and while loop takes takes lot of time.</p>
  
  <p>Is there any possibility in the select statement itself for above requirement.</p>
  
  <p>Thanks!</p>