title: SQL Server 2005: Call a stored procedure from a WHERE clause
body: <p>I need to make a SELECT with a call of a stored procedure in the WHERE clause.
  It should be something like that....</p>
  
  <p>SELECT distinct top 10 i.x, d.droit 
  FROM v_droit d, v_info i
  WHERE d.nomdroit='yy'
        AND i.id&lt;>2
        AND (select val from (exec up_droits(i.x, d.droit)) &lt;>3</p>
  
  <p>But it does not work...
  Any idea?</p>
  
  <p>Don't say to replace the stored procedure with a function because is not possible to use the existing code in a function. So the function is not a valid option. I really need to be able to use a stored procedure</p>