title: Stored procedure returns no columns
body: <p>I have the following stored procedure :</p>
  
  <pre><code> SET ANSI_NULLS ON
   GO
   SET QUOTED_IDENTIFIER ON
   GO
   ALTER PROCEDURE [dbo].[SearchMediaTitles] 
  
     @query varchar(50),
     @limit int = 6,
     @userId int
   AS
   SET FMTONLY OFF
   BEGIN
  
   declare @searchString varchar(52)
  
   set @searchString = '"' + @query +'*"'
   IF @userId!=NULL
   SELECT TOP (@limit) ID, Title from Media where CONTAINS([Title], @searchString)
   AND ID IN
    (
    SELECT FavoriteMedia_ID
    FROM dbo.UserMedia
    WHERE UserMedia_Media_ID=@userId
    )
   ELSE
   SELECT TOP (@limit) ID, Title from Media where CONTAINS([Title], @searchString)
  
   END
  </code></pre>
  
  <p>In Entity Framework when I try to map it at function import for a complex type it says </p>
  
  <blockquote>
    <p><em>the selected stored procedure returns no columns</em></p>
  </blockquote>
  
  <p>I've read about this on the internet and I found out I need to set <code>SET FMTONLY OFF</code>, but as you can see it didn't work.</p>
  
  <p>Any ideas?</p>
  
  <p><strong>EDIT</strong>:</p>
  
  <p>I've changed <code>SELECT</code> to <code>*</code> and it return an empty result. I think it's related to problem described above</p>