The return types for the following stored procedures could not be detected

后端 未结 15 2131
小鲜肉
小鲜肉 2020-12-09 08:09

While drag-drop a stored procedure in dbml file I get this error:

Unknown Return Type
The return types for the following stored

相关标签:
15条回答
  • 2020-12-09 08:52

    Just ran into this issue while trying to add a stored procedure into a DBML (LINQ) file.

    Doing some research I found that this usually happens when the stored procedure returns multiple results or uses a #temp table for it's final select.

    The solution that worked for me was to create a new stored procedure that wrapped the results of the original stored procedure result, into a table variable with the same columns as the temp table.

    My wrapper stored proc looked something like this:

    DECLARE @NewPrograms TABLE (
        Campaign_Number int,
        Campaign_Display nvarchar(255)
    )
    
    INSERT INTO @NewPrograms
        EXEC [dbo].[Original_Stored_Proc_With_Temp_Table_Result] @Program_ID
    
    
    Select * 
    From @NewPrograms
    

    Open up your DBML file, drag-and-drop in your new wrapper stored proc.

    0 讨论(0)
  • 2020-12-09 08:53

    I've just added about 300 stored procs to my DBML and experienced many of the problems noted here and elsewhere.

    Here is a summary of the causes & solutions for the error "The return types for the following stored procedures could not be detected", based on what I have personally experienced. Note that the problems described below can occur in the SP that you are having the error with, or any other SP that is being called from that SP directly or indirectly.

    • Concatenating integers with string using a '+' symbol. Use CAST() on the integers, or in SQL2012 or higher use the CONCAT() statement.
    • Referencing tables in other databases. Apparently a permissions issue. I wasn't able to resolve this one.
    • Any direct or indirect call to XP_CMDSHELL. I wasn't able to resolve this one.
    • Any syntax error in direct or indirect calls to other stored procs. Fix the call to the SP.
    • Temp Tables. Replace the Temp Table with a Table Variable.
    • SET QUOTED_IDENTIFIER OFF is in use, but the table being edited has a Indexed View on it. *Change the set statement to SET QUOTED_IDENTIFIER ON.*
    0 讨论(0)
  • 2020-12-09 08:56

    I had this error too and finally I found out that I have changed a table field name and in procedure it did not change it yet, and so it showed an error when adding to dbml.
    Now you can check this on your procedure and your table that fields are the same.

    I hope this experience is useful.

    0 讨论(0)
提交回复
热议问题