Unable to reverse engineer stored procedure using TVP parameter with NVARCHAR(MAX) column
See original GitHub issueUnable to reverse engineer stored procedure using TVP as parameter because the TVP includes columns with NVARCHAR(MAX).
Error Output:
Unable to get result set shape for PROCEDURE 'dbo.MyProcedure'
System.Data.DuplicateNameException: A column named 'ColumnName' already belongs to this DataTable.
at System.Data.DataColumnCollection.RegisterColumnName(String name, DataColumn column)
at System.Data.DataColumnCollection.BaseAdd(DataColumn column)
at System.Data.DataColumnCollection.AddAt(Int32 index, DataColumn column)
at RevEng.Core.Procedures.SqlServerStoredProcedureModelFactory.GetDataTableFromSchema(ModuleParameter parameter, SqlConnection connection) in C:\Code\EFCorePowerTools\src\GUI\RevEng.Core\Procedures\SqlServerStoredProcedureModelFactory.cs:line 155
at RevEng.Core.Procedures.SqlServerStoredProcedureModelFactory.GetAllResultSets(SqlConnection connection, Routine module, Boolean singleResult) in C:\Code\EFCorePowerTools\src\GUI\RevEng.Core\Procedures\SqlServerStoredProcedureModelFactory.cs:line 83
at RevEng.Core.Procedures.SqlServerStoredProcedureModelFactory.GetResultElementLists(SqlConnection connection, Routine module, Boolean multipleResults, Boolean useLegacyResultSetDiscovery) in C:\Code\EFCorePowerTools\src\GUI\RevEng.Core\Procedures\SqlServerStoredProcedureModelFactory.cs:line 62
at RevEng.Core.Procedures.SqlServerRoutineModelFactory.GetRoutines(String connectionString, ModuleModelFactoryOptions options) in C:\Code\EFCorePowerTools\src\GUI\RevEng.Core\Routines\SqlServerRoutineModelFactory.cs:line 25
I noticed that recent changes to SqlServerStoredProcedureModelFactory.GetDataTableFromSchema
don’t compensate for the sysname datatypes with the same name returned alongside NVARCHAR(MAX). Maybe we filter those out?
EF Core version in use: EF Core 6
Is Handlebars used: no
EF Core Power Tools version: 2.5.963
Database engine: SQL Server, Azure SQL
Visual Studio version: Visual Studio 2022 - Preview 4
Issue Analytics
- State:
- Created a year ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Facing issue connecting stored procedure with nvarchar(max ...
As a work around i changed variable to nvarchar(255) and then cast it to int in query it worked.
Read more >nvarchar(max) still being truncated
So I'm writing a stored procedure in MS SQL Server 2008. It's a really long query and I have to write it dynamically,...
Read more >Release notes · ErikEJ/EFCorePowerTools Wiki
Unable to reverse engineer stored procedure using SET FMTONLY with TVP parameter with NVARCHAR(MAX) column #1361; Unable to reverse engineer ...
Read more >Consuming JSON Strings in SQL Server - Simple Talk
The values, or name/value pairs are retrieved from the string table and stored in the hierarchy table. Gradually, the JSON document is eaten ......
Read more >Reducing the Size of your Database in SQL Server 2005/SP2
This storage format lets you reduce the size of your table significantly if the table has one of more columns of type decimal...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in latest daily, please let me know if it works for you
@ErikEJ Thanks ,now it works