Entity framework stored procedure always returning int

http://www.devtoolshed.com/using-stored-procedures-entity-framework-scalar-return-values

http://stackoverflow.com/questions/18245567/stored-procedure-returns-int-instead-of-result-set

I have a stored procedure that contains dynamic select. Something like this:

ALTER PROCEDURE [dbo].[usp_GetTestRecords]
–@p1 int = 0,
–@p2 int = 0
@groupId nvarchar(10) = 0
AS
BEGIN
SET NOCOUNT ON;

DECLARE @query NVARCHAR(max)

SET @query = ‘SELECT * FROM CUSTOMERS WHERE Id = ‘ + @groupId
/* This actually contains a dynamic pivot select statement */

EXECUTE(@query);
END

Answer :

SET FMTONLY OFF

or

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: