Description
The documentation for SQL Raw querying (passthrough) in EF Core is nicely done, so good on that. I only need a few more examples for "deeper" stored procedures, which are far more likely "in the field". The following procedure call (argued), takes a tabbed text file, which is very useful in Azure, and implements an OLEDB "OPENROWSET" with a format file, to seed raw data into a table. Here, we pass arguments into an INPUT parameter, and receive OUTPUT data as to return code (standard practice), success output, and the path for an error file. Azure offers a URL to a BLOB, so if this procedure is to be implemented on Azure, I would need to test further on that platform. We need documentation that explains more complex scenarios like this, both on-Premises, and with the Azure offerings. Really, it is very common to SEED tables with raw, tabbed text files - a lot more common than anyone might assume. Anyway, Mr. Vickers and friends, we here at Monkey Brains Studio do very much appreciate the great documentation that you and the team have produced. Also, seeing Mr. Bill Gates on MSNBC today, who was discussing the Pandemic in a very honest and open way, inspired me go back to this computer and key this issue in to GitHub. Thanks to everyone there! So, without further ado and many debts due, here is the signature I offer for a more specific attempt to further document just how EF Core would handle such a scenario:
DECLARE @ReturnCode INTEGER,
@SchemaName NVARCHAR(20),
@TableName NVARCHAR(100),
@UNC_QualifiedErrorFilePath NVARCHAR(200),
@UNC_QualifiedSeedFilePath NVARCHAR(200),
@UNC_QualifiedFormatFilePath NVARCHAR(200),
@PrintOnly BIT,
@WithTruncate BIT,
@InsertErrorRowOnly BIT,
@Message_OUT NVARCHAR(MAX),
@ErrorMessage_OUT NVARCHAR(MAX),
@RowCount_OUT INTEGER;
EXECUTE [Meta].[Seeding]
@SchemaName = [Hub],
@TableName = [Intervals],
@CodePage = 1252,
@StartingRow = 1,
@UNC_QualifiedErrorFilePath = '\\WHITESAND\OutputFiles\Errors.txt',
@UNC_QualifiedSeedFilePath = '\\WHITESAND\InputFiles\Intervals.txt',
@UNC_QualifiedFormatFilePath = '\\WHITESAND\FormatFiles\Intervals.xml',
@PrintOnly = 0,
@WithTruncate = 1,
@InsertErrorRowOnly = 0,
@Message_OUT = @Message_OUT OUTPUT,
@ErrorMessage_OUT = @ErrorMessage_OUT OUTPUT,
@RowCount_OUT = @RowCount_OUT OUTPUT;
GO
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 7e1289d5-8364-18a4-3445-6bba05c6854b
- Version Independent ID: 2680e647-f64a-7991-f821-3b5e2a845960
- Content: Raw SQL Queries - EF Core
- Content Source: entity-framework/core/querying/raw-sql.md
- Product: entity-framework
- Technology: entity-framework-core
- GitHub Login: @smitpatel
- Microsoft Alias: avickers