Page 1 of 1

Issues with Temporary Table which using CommandBehavior.SchemaOnly

Posted: Thu 28 Aug 2014 14:12
by keithnolan
I have a simple Stored Procedure as follows

ALTER PROCEDURE [dbo].[PRC_LGX_TEST]
AS
BEGIN
SELECT TEST_ID
INTO #STAGE1
FROM TBL_TEST

SELECT TEST_ID
FROM #STAGE1

DROP TABLE #STAGE1
END

When running from within SQL server or actually returning the data through the DevArt Driver all is fine, however when I do the following:

DbDataReader dbRed = com.ExecuteReader(CommandBehavior.SchemaOnly);

I get the following error:
Invalid object name '#STAGE1'. at Devart.Data.SqlServer.bd.a(CommandBehavior A_0) at Devart.Data.SqlServer.SqlCommand.InternalExecute(CommandBehavior behavior, IDisposable stmt, Int32 startRecord, Int32 maxRecords) at Devart.Common.DbCommandBase.InternalExecute(CommandBehavior behavior, IDisposable stmt, Int32 startRecord, Int32 maxRecords, Boolean nonQuery) at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery) at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) at Devart.Data.SqlServer.SqlCommand.ExecuteReader(CommandBehavior behavior)

As I said when I remove the SchemaOnly it works correctly, however I'm trying to retrieve the meta data of the SP and not the data. Any ideas? I'm using build 2.50.483.0. Thanks.

Re: Issues with Temporary Table which using CommandBehavior.SchemaOnly

Posted: Fri 29 Aug 2014 14:13
by Pinturiccio
We have reproduced the issue with CommandBehavior.SchemaOnly parameter of the ExecuteReader method. However this issue is reproduced with System.Data.SqlClient provider as well.

dotConnect for SQL Server is based on System.Data.SqlClient, and if the issue is reproduced with the System.Data.SqlClient provider, it will be reproduced with dotConnect for SQL Server too, so please contact the Microsoft support on this question.