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.

Ability to reverse engineer stored procedures using temp tables.

See original GitHub issue

Perhaps this is a known issue, and in that case apologies… It would be nice to have the ability to reverse engineer stored procedures that create and use temp tables. When I Reverse Engineer a database with stored procedures that include a temp table, the extension throws an error:

The metadata could not be determined because statement ‘INSERT #x (something, somethingelse) SELECT ‘wow’, GETDATE()’ in procedure ‘test’ uses a temp table. Unable to scaffold UpdateIncomingSpec

Steps to reproduce

  • Reverse Engineer a database
  • include stored procedures
  • use a stored procedure that includes a temp table.
  • example sproc:

CREATE PROC [dbo].[test]
	@DetailID INT,
	@returnCode INT OUTPUT,
	@result VARCHAR (MAX) OUTPUT
AS

SET NOCOUNT ON

CREATE TABLE #x (
	something VARCHAR (MAX) NOT NULL,
	somethingelse VARCHAR (MAX) NOT NULL
	);

INSERT #x (something, somethingelse)
SELECT 'wow', GETDATE()

BEGIN
	SELECT @ReturnCode = 0, @Result = '';
END

DROP TABLE #x;
GO

Further technical details

EF Core Power Tools version: 2.4.236.0

Database engine: SQL Server

Visual Studio version: VS2019 16.7.5

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
ErikEJcommented, Oct 29, 2020

Fixed in latest daily build

2reactions
ErikEJcommented, Feb 17, 2021

There is no fix, but an empty result class is created, and you can manually add the properties.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mapping and using SQL Server stored procedures with EF ...
First two select statements put data into temp tables and the third ... Using EF core power tool reverse engineering for accessing stored...
Read more >
Using temporary tables in stored procedure - Ask TOM - Oracle
Using temporary tables in stored procedure Hi Tom,I am used to use MS SQL Server or Sybase to create stored procedures for reporting....
Read more >
EF can't infer return schema from Stored Procedure ...
Solution 1 Use a table variable instead of a temporary table. Solution 2 Use the Set FMTONLY off; SQL command in the procedure...
Read more >
Temp Tables vs Variable Tables — SQL Data Preparation
Variable tables are only designed to hold small amounts of data. A concept for another day involves execution plans which, for example, a...
Read more >
External Temp Tables Preventing Plan Reuse in Stored ...
Because we're now using a table type, SQL will know the schema and if our theory to this point holds water, should be...
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