title: Error 6046: Unable to generate function import return type of the store function
body: <p>I have a scalar-valued function in my sql database.</p>
  
  <p>I receive this error when importing this function into Entity Framework model:</p>
  
  <pre><code>Error 6046: Unable to generate function import return type of the store function 'GetContentByIdAndCul'.
  The store function will be ignored and the function import will not be generated.   ..\EntityModels.edmx
  </code></pre>
  
  <p>my function tsql is:</p>
  
  <pre><code>ALTER FUNCTION [FRM].[GetContentByIdAndCul] 
  (@Id int,@Culture nvarchar(5))
  RETURNS nvarchar(max)
  AS
  BEGIN
  declare @Result nvarchar(max)
  
  if @Id is not null
      set @Result='This Content not defined in this Language'
  
  select @Result=Value from CUL.Contents
  WHERE ID=@Id AND (CUL.Contents.Culture = LOWER(@Culture) 
              OR CUL.Contents.Culture = LOWER(SUBSTRING(@Culture,1,2)))   
  return @Result      
  END
  </code></pre>