I got a website with a form full of settings where each of the inputs save a value in a MS SQL Database.
But when i set a field to '' i got the following error message: "The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 3 (""): Data type 0x00 is unknown."
My node.js service calls a stored procedure which looks like this:
CREATE PROCEDURE [dbo].[ckd_Configurations_Update]
@Key NVARCHAR(256),
@Value NVARCHAR(MAX)
AS
BEGIN
UPDATE [dbo].[ckd_Configurations] SET [Value]=@Value WHERE [Key]=@Key;
END
My table:
CREATE TABLE [dbo].[ckd_Configurations]
(
[Key] NVARCHAR(256) NOT NULL PRIMARY KEY,
[Value] NVARCHAR(MAX)
)
And finally my node.js route to set the configurations:
router.post('/configurations/update', function (req, res) {
var request = new sql.Request(databaseConnection);
var configuration = req.body;
request.input('Key', sql.NVarChar(256), configuration.Key);
request.input('Value', sql.NVarChar(sql.MAX), configuration.Value);
request.execute('ckd_Configurations_Update', function (error, recordsets) {
if (error) {
res.json(new apiResponse(false, error.message));
} else {
res.json(new apiResponse(true, '', recordsets[0]));
}
});
});
Just update mssql to 2.0. The issue was fixed in this release.