question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to get result set shape for PROCEDURE 'dbo.Department_Delete'

See original GitHub issue

Describe what is not working as expected.

Steps to reproduce

  1. Create database from this script: https://gist.githubusercontent.com/doggy8088/2a2f7075d49b3814d19513426ede3549/raw/56926225027def21c627dd6391ab4866957ca5ac/ContosoUniversity.sql

  2. Create new project and use Reverse Engineer to generate classes including all Stored Procedures.

  3. You will see errors in the Output window.

    Unable to get result set shape for PROCEDURE 'dbo.Department_Delete'
    Microsoft.Data.SqlClient.SqlException (0x80131904): Implicit conversion from data type nvarchar to timestamp is not allowed. Use the CONVERT function to run this query.
       at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
       at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
       at Microsoft.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
       at Microsoft.Data.SqlClient.SqlDataReader.get_MetaData()
       at Microsoft.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
       at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean isAsync, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
       at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String method)
       at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
       at Microsoft.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
       at RevEng.Core.Procedures.SqlServerStoredProcedureModelFactory.GetAllResultSets(SqlConnection connection, Routine module, Boolean singleResult) in C:\Code\Github\EFCorePowerTools\src\GUI\RevEng.Core\Procedures\SqlServerStoredProcedureModelFactory.cs:line 90
       at RevEng.Core.Procedures.SqlServerStoredProcedureModelFactory.GetResultElementLists(SqlConnection connection, Routine module, Boolean multipleResults, Boolean useLegacyResultSetDiscovery) in C:\Code\Github\EFCorePowerTools\src\GUI\RevEng.Core\Procedures\SqlServerStoredProcedureModelFactory.cs:line 62
       at RevEng.Core.Procedures.SqlServerRoutineModelFactory.GetRoutines(String connectionString, ModuleModelFactoryOptions options) in C:\Code\Github\EFCorePowerTools\src\GUI\RevEng.Core\Routines\SqlServerRoutineModelFactory.cs:line 25
    ClientConnectionId:da352c90-8d89-4478-8993-4fccda4ea117
    Error Number:257,State:3,Class:16
    
    Unable to get result set shape for PROCEDURE 'dbo.Department_Update'
    Microsoft.Data.SqlClient.SqlException (0x80131904): Implicit conversion from data type nvarchar to timestamp is not allowed. Use the CONVERT function to run this query.
       at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
       at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
       at Microsoft.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
       at Microsoft.Data.SqlClient.SqlDataReader.get_MetaData()
       at Microsoft.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
       at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean isAsync, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
       at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String method)
       at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
       at Microsoft.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
       at RevEng.Core.Procedures.SqlServerStoredProcedureModelFactory.GetAllResultSets(SqlConnection connection, Routine module, Boolean singleResult) in C:\Code\Github\EFCorePowerTools\src\GUI\RevEng.Core\Procedures\SqlServerStoredProcedureModelFactory.cs:line 90
       at RevEng.Core.Procedures.SqlServerStoredProcedureModelFactory.GetResultElementLists(SqlConnection connection, Routine module, Boolean multipleResults, Boolean useLegacyResultSetDiscovery) in C:\Code\Github\EFCorePowerTools\src\GUI\RevEng.Core\Procedures\SqlServerStoredProcedureModelFactory.cs:line 62
       at RevEng.Core.Procedures.SqlServerRoutineModelFactory.GetRoutines(String connectionString, ModuleModelFactoryOptions options) in C:\Code\Github\EFCorePowerTools\src\GUI\RevEng.Core\Routines\SqlServerRoutineModelFactory.cs:line 25
    ClientConnectionId:da352c90-8d89-4478-8993-4fccda4ea117
    Error Number:257,State:3,Class:16
    

Further technical details

EF Core version in use: EF Core 6

Is Handlebars used: no

EF Core Power Tools version: 2.5.977.0

Database engine: SQL Server

Visual Studio version: Visual Studio 2022

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
doggy8088commented, May 6, 2022

I tested. It works great! 👍

0reactions
ErikEJcommented, Jul 7, 2022

@mustafaelshobaky please don’t add to closed issues.

This error was always there, it was just not communicated back previously.

You will have to refactor your stored proc in create the result set shape yourself as described in the wiki.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to load stored procedure result set into temporary ...
The stored procedure results are not stored into the temp table. It is showing "0 rows affected". Example #1: EXEC dbo.emp (10 row( ......
Read more >
sql server - metadata could not be determined because ...
Consider using the WITH RESULT SETS clause to explicitly describe the result set. My real stored procedure is a bit more complex but...
Read more >
Error with Retrieve Result Shape | Telerik Forums
Nothing unique in the result set, no use of cursors in the stored procedure, just a simple SELECT, no JOINS. The cause of...
Read more >
Error "The stored procedure ... does not return a result set ...
The "[dbo].[<stored procedure name>]" stored procedure returned no results. The fields don't have column names, or the data in the fields is ...
Read more >
sp_describe_first_result_set (Transact-SQL) - SQL Server
If the procedure is called from Transact-SQL, the return value is always zero, even when there is an error. Result Sets. This common...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found