title: Calling a UDF with Entity SQL but without a FROM clause?
body: <p>Am trying to call a UDF which just takes a parameter and returns a scalar.  The examples I've seen all use a From clause: <a href="http://blogs.microsoft.co.il/blogs/gilf/archive/2009/10/20/calling-user-defined-functions-udfs-in-entity-framework.aspx" rel="nofollow">http://blogs.microsoft.co.il/blogs/gilf/archive/2009/10/20/calling-user-defined-functions-udfs-in-entity-framework.aspx</a></p>
  
  <p>But I only want to call the UDF, I don't want to "join" it with any entities using a from clause:</p>
  
  <pre><code>  string fieldTag = "TagNameHere";
    var sql = "SELECT XyzModel.Store.FieldNameToFormIdMap(@fieldTag)";
    System.Data.Objects.ObjectQuery&lt;int&gt; query =
      new System.Data.Objects.ObjectQuery&lt;int&gt;(sql, xyzEntitiesContext);
    query.Parameters.Add(new System.Data.Objects.ObjectParameter("fieldTag", fieldTag));
  </code></pre>
  
  <p>I get the error: "The query syntax is not valid."</p>
  
  <p>This is using .NET 3.5</p>
  
  <p>I could use old style ADO.NET but I'd rather not have to manage another set of connection strings aside from those used for the entity framework.</p>