title: user defined function call vs calling UDF in a Store procedure
body: <p>I have a user defined function that is called inside a stored procedure. All that stored procedure does is return the value that is obtained from the UDF scalar function. </p>
  
  <p>However,</p>
  
  <pre><code>Select * UDF_FunctionName(param1,param2) 
  </code></pre>
  
  <p>udf call is here-</p>
  
  <pre><code>SELECT dbo.udfFunction('1234',10) as result 
  </code></pre>
  
  <p>and </p>
  
  <pre><code>Exec StoreProcName(param1,param2) 
  </code></pre>
  
  <p>are returning different results. </p>
  
  <p><code>StoreProcName</code> calls the `UDF_FunctionName(param1,param2)</p>
  
  <p>sproc code is here-</p>
  
  <pre><code>BEGIN 
   SET NOCOUNT ON; 
   Return SELECT [DbName].[dbo].[udfFunction](@param1, @param2) 
  END 
  </code></pre>
  
  <p>What could be the reason for different results?.</p>