Issues with Temporary Table which using CommandBehavior.SchemaOnly

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Microsoft SQL Server
Post Reply
keithnolan
Posts: 10
Joined: Fri 25 Mar 2011 15:17
Location: Please select

Issues with Temporary Table which using CommandBehavior.SchemaOnly

Post by keithnolan » Thu 28 Aug 2014 14:12

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.

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: Issues with Temporary Table which using CommandBehavior.SchemaOnly

Post by Pinturiccio » Fri 29 Aug 2014 14:13

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.

Post Reply