title: How to return varchar value from a function
body: <p>I written the following function.</p>
  
  <pre><code>SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  Create FUNCTION NameFunction
  (
      @eid int
  )
  RETURNS varchar
  AS
  BEGIN
      Declare @logid varchar(50);
      SELECT @logid = E.LoginId from HumanResources.Employee As E
      where E.BusinessEntityID = @eid
  
      RETURN  @logid
  
  END
  GO
  </code></pre>
  
  <p>When I am executing it is showing result as <code>a</code>.
  But expected result is <code>adventure-works\terri0</code> 
  Where I did the mistake here. Only first character coming. Need to change any thing?</p>