title: How to pass parameter to mssql query in node js
body: <p>I am changing my application's database from MySQL to MSSQL. I send parameters like below for MySQL database.</p>
  
  <pre><code>var sql = require('./db.js');
  sql.query("select * from table where field1 = ? or field2 = ? ", [field1val, field2val], function (error, results) {
     if(error){
         //handle error
     }
     else{
        //handle the results
     } 
  }
  </code></pre>
  
  <p>How to do this in MSSQL or is it even possible to do this way? (I am using <code>mssql</code> module).</p>
  
  <p>The stored procedure is the only way to achieve it? If so, how to do that in Nodejs mssql module? </p>
  
  <p>What is the best practice to run a query in SQL server if we can't send parameter (which escapes the string in mysql automatically)?</p>