none
Executing a custom function gets "stored procedures are not supported" RRS feed

  • Question

  • I Defined a custom function in my storage model and a FunctionImport in my conceptual model. When I executed this function I get error "Stored procedures are not supported by SQL Server Compact." But this is not a stored procedure My custom function is a update statement. Shouldn't  SQL Server Compact be able to execute it?
    Thursday, October 31, 2013 4:20 AM

All replies

  • Hello DavidSherwood,

    It is appreciated that if you can share the function and the program environment.

    I did a test that with environment as below:

    VS2012, .Net Framework 4.5, Entity Framework 5, SQLServer 2012.

    The function codes is:

    CREATE FUNCTION [dbo].[SelectStatesTableFun](   @param1 int)
    
    RETURNS TABLE
    
    AS
    
    RETURN 
    
    (
    
        SELECT StatesId,StatesName from States where StatesId = @param1
    
    ); 
    

    The execute codes and the result:

    using (DataBaseFirstDBEntities db = new DataBaseFirstDBEntities())
    
                {
    
                                 var result = db.SelectStatesTableFun(1).ToList();
    
                }
    

    Regards


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, November 1, 2013 8:46 AM
    Moderator
  • I don't understand in what language you wrote the function. My function was defined in the storage model:
     <Function Name="SetSpellCheck" IsComposable="false">
        <CommandText>
            Update SpellCheck
            Set IgnoredWords = @IgnoredWords
            Where SpellCheckId = 1;
        </CommandText>
        <Parameter Name="IgnoredWords"
                   Mode="In"
                   Type="ntext" />
    </Function>
    I'm using EF 4.1 net 4.0 and VS 2010.
    • Edited by DavidSherwood Monday, November 4, 2013 3:18 PM wrong word
    Monday, November 4, 2013 3:14 PM
  • Oh,

    I used Entity Framework 5 and it is very simple to import the function or store procedure.

    And I recommend to update it to Entity Framework 5 or higher.

    For using Entity Framework 5 with function:

    http://msdn.microsoft.com/en-us/data/gg699321.aspx

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, November 5, 2013 8:01 AM
    Moderator
  • I think you  are missing my point. I am not using stored procedures. I'm only getting an error that says stored procedures are not supported in SQL Server Compact. I do believe the error is correct. I just don't understand why I'm am getting it since  I am not using stored procedures.

    As to using EF 5. That depends on net 4.5 which depends on VS 20012 which I have problems with. So I'm stuck with VS 2010 which means I stuck with net 4.0 which means I'm stuck with EF 4.1.

    Tuesday, November 5, 2013 8:39 AM