title: LINQ's FirstOrDefault in SQL script?
body: <p>What is the SQL language keyword for the LINQ-to-SQL <code>FirstOrDefault</code> or <code>SingleOrDefault</code>?</p>
  
  <p>Is it <code>TOP(1)</code>?</p>
  
  <p>EXAMPLE:</p>
  
  <pre><code>SELECT TOP(1) @ItemCode = ItemCode FROM VendorItem WHERE VendorId = @VendorId 
  </code></pre>
  
  <p>There can't be more than 1 results anyway since there is a Unique Key constranint, do I have to spell out the TOP(1) or whatever it is?</p>
  
  <p>Note: I don't need LINQ answers, my question is how to write the <strong>sql</strong> script.</p>