A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/tediousjs/node-mssql/issues/68 below:

SQL Server 2000 error with queries longer than 4000 characters · Issue #68 · tediousjs/node-mssql · GitHub

When running this code with a query where query.length>4000:

var sql   = require('mssql');
var config = {
  server   : '1.2.3.4',
  user     : 'abc',
  password : 'def',
  options  : {
    tdsVersion: '7_1' //needed for SQL server version 2000
  }
};

sql.connect(config, function(err) {
  if (err)
    return console.error(err);

  var request = new sql.Request();

  var tmp = [];
  tmp.length=3983;

  var query = '/*'+tmp.join('x')+'*/ SELECT 1 as ok';

  console.log('sql length = '+query.length);
  request.query(query, function(err, result) {
    if (err)
      return console.error(err);

    console.log(result)
  });
});

This is what I get:

sql length = 4001
undefined

events.js:72
        throw er; // Unhandled 'error' event
              ^
ConnectionError: Failed to connect to 1.2.3.4:1433 - read ECONNRESET
    at Connection.socketError (...\node_modules\mssql\node_modules\tedious\lib\connection.js:681:26)
    at Socket.<anonymous> (...\node_modules\mssql\node_modules\tedious\lib\connection.js:3:59)
    at Socket.EventEmitter.emit (events.js:95:17)
    at net.js:441:14
    at process._tickCallback (node.js:415:13)

When I make the query 1 character shorter, it's working.

sql length = 4000
[ { ok: 1 } ]

I can provide you with debug info later today.... Will update this post once done.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4