While drag-drop a stored procedure in dbml file I get this error:
Unknown Return Type
The return types for the following stored procedures could not be detected. Set the return type for each stored procedure in the Properties window.
How can I resolve this error?
Return Value in SQL Server Stored Procedure In default, when we execute a stored procedure in SQL Server, it returns an integer value and this value indicates the execution status of the stored procedure. The 0 value indicates, the procedure is completed successfully and the non-zero values indicate an error.
You can use one or more RETURN statements in a stored procedure. The RETURN statement can be used anywhere after the declaration blocks within the SQL-procedure-body. To return multiple output values, parameters can be used instead. Parameter values must be set before the RETURN statement runs.
No, the return type of a stored procedure is INT and it cannot be null.
The RETURN exits the stored procedure, and nothing that follows it will be executed, including the SELECT statement on the following line. Otherwise, if you want the data for the entire table, as your question shows, add a SELECT after the INSERT . But don't put RETURN in front of it!
This problem occurs whenever the designer cannot figure out the return type of the SP.
Same problem and solutions described here
How to get multiple result set of procedure using LINQ to SQL
Basically this is the solution from the link:
Avoid using #temp Table in your stored procedure, instead of you can use Table type variable like below (@TempTable)
Ex:
DECLARE @TempTable TABLE ( AttributeID INT, Value NVARCHAR(200) ) INSERT INTO @TempTable Select * from Attribute OR --Execute SP and insert results into @TempTable INSERT INTO @TempTable Exec GetAttribute @Id
You can do all operation which you was doing with #Temp table like Join, Insert, Select etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With