title: inner join Vs scalar Function
body: <p>Which of the following query is better... This is just an example, there are numerous situations, where I want the user name to be displayed instead of UserID</p>
  
  <pre><code>Select  EmailDate, B.EmployeeName as [UserName], EmailSubject
      from Trn_Misc_Email as A
           inner join 
           Mst_Users as B on A.CreatedUserID = B.EmployeeLoginName
  </code></pre>
  
  <p>or </p>
  
  <pre><code>Select  EmailDate, GetUserName(CreatedUserID) as [UserName], EmailSubject
      from Trn_Misc_Email
  </code></pre>
  
  <p>If there is no performance benefit in using the First, I would prefer using the second...  I would be having around 2000 records in User Table and 100k records in email table...</p>
  
  <p>Thanks</p>