Issues with Temporary Table which using CommandBehavior.SchemaOnly
Posted: 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.
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.