MSSQL doesn't seem to be able to capture output record sets coming from a stored procedure that follows a message from PRINT, some ANSI warnings, or an informational message (i.e. severity <= 10).
Expected behaviour:
Capture all output from SQL Server regardless
Actual behaviour:
Configuration:
I was able to replicate with the following:
SP in SQL Server:
CREATE PROCEDURE [dbo].[NullEliminated] (@P1 TINYINT)
AS
BEGIN
SET NOCOUNT ON;
SELECT 'First query' 'FirstQuery';
SELECT 'Second query' 'SecondQuery';
PRINT 'That was second; now we do third';
SELECT 'Third query' 'ThirdQuery';
SELECT 'Fourth query' 'FourthQuery';
END
JS:
const sql = require('mssql/msnodesqlv8');
const config = {
database: 'YourDBHere',
server: 'YourServerHere',
driver: 'msnodesqlv8',
connectionTimeout: 1500,
requestTimeout: 1500,
options: {
trustedConnection: true
}
};
const pool = new sql.ConnectionPool(config);
async function testing() {
await pool.connect();
const request = new sql.Request(pool);
request.on('info', info => {
console.dir(info);
});
let result = await request
.input('P1', 1)
.execute('NullEliminated');
console.dir(result.recordsets);
}
testing();
SQL Server: Microsoft SQL Server 2017 (RTM-CU31) (KB5016884) - 14.0.3456.2 (X64) Sep 2 2022 11:01:50 Copyright (C) 2017 Microsoft Corporation Developer Edition (64-bit) on Windows Server 2016 Standard 10.0 (Build 14393: ) (Hypervisor)
MSSQL doesn't seem to be able to capture output record sets coming from a stored procedure that follows a message from PRINT, some ANSI warnings, or an informational message (i.e. severity <= 10).
Expected behaviour:
Capture all output from SQL Server regardless
Actual behaviour:
Configuration:
I was able to replicate with the following:
SP in SQL Server:
JS:
Output:
Software versions