title: Error while running node-mssql query
body: <p>I am trying to run node-mssql query, if I run simple quires it is getting executed. But when I use <code>OPENROWSET</code> and <code>Microsoft.ACE.OLEDB.12.0</code>, it is showing some errors. </p>
  
  <p>Here is <strong>server.js</strong> code</p>
  
  <pre><code>var express = require('express');
  var app = express();
  app.get('/', function (req, res) {
  
  var sql = require("mssql");
  
  // config for your database
  var config = {
      user: '..',
      password: '....',
      server: 'localhost\\SQLEXPRESS', 
      database: 'test_databasae' 
  };
  
  // connect to your database
  sql.connect(config, function (err) {
  
      if (err)
           console.log(err);
       else
          console.log("Connection successful");
  
  
      // create Request object
      var request = new sql.Request();
  
      // query to the database and get the records
      /*request.query('select * from table1', function (err, recordset) {
  
          if (err) console.log(err)
  
          // send records as a response
          res.send(recordset);
  
      });*/
      request.query('INSERT INTO [mytable](SalesPersonID,TerritoryID)' + 
                      'SELECT SalesPersonID,TerritoryID FROM OPENROWSET('  + 
                      '\'Microsoft.ACE.OLEDB.12.0\',\'Excel 12.0\';\'Database=D:\\sample\\test\\data\\1540_OPENROWSET_Examples.xls;,\'' + 
                      'SELECT SalesPersonID, TerritoryID FROM [SELECT_Example$])',function(err,recordset){
          if(err) console.log(err)
  
          console.log("success");
      }); 
  });});var server = app.listen(5000, function () {
  console.log('Server is running..');});`
  </code></pre>
  
  <p>and when i hit <strong>node server.js</strong> on command prompt I am getting following errors on command prompt: </p>
  
  <pre><code>Server is running..
  Connection successful
  { [RequestError: Incorrect syntax near ')'.]
    name: 'RequestError',
    message: 'Incorrect syntax near \')\'.',
    code: 'EREQUEST',
    number: 102,
    lineNumber: 1,
    state: 1,
    class: 15,
    serverName: 'localhost\\SQLEXPRESS',
    procName: '',
    precedingErrors:
     [ { [RequestError: Incorrect syntax near the keyword 'SELECT'.]
         name: 'RequestError',
         message: 'Incorrect syntax near the keyword \'SELECT\'.',
         code: 'EREQUEST',
         number: 156,
         lineNumber: 1,
         state: 1,
         class: 15,
         serverName: 'localhost\\SQLEXPRESS',
         procName: '' } ] }
  success
  </code></pre>
  
  <p>The same query is getting executed in SQL Server Management Studio , it is successfully inserting excel data to database.Excel sheet data looks like this:</p>
  
  <pre><code>SalesPersonID   TerritoryID
  --------        -----------
  275              2
  276              4
  277              3
  </code></pre>
  
  <p><a href="https://plnkr.co/edit/h03hfPtqlPRRJEvTWK8H?p=catalogue" rel="nofollow">Here is the plunker link</a> </p>