Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Package summary
Share
0
issues
0
licenses
Package created
10 Aug 2013
Version published
16 Jan 2024
Maintainers
4
Total deps
0
Direct deps
0
License
MIT
Generating a report...
Hold on while we generate a fresh audit report for this package.

Frequently Asked Questions

What does mssql do?

MSSQL is a popular npm package that serves as a Microsoft SQL Server client for Node.js. It allows Node.js applications to interact with SQL Server databases, streamline database queries, and enact safe handling of different data types.

How do you use mssql?

Here are some examples of how you can use mssql:

Installation:

npm install mssql

Connect to Microsoft SQL Server using a connection string:

const sql = require('mssql')

async () => {
    try {
        await sql.connect('Server=localhost,1433;Database=database;User Id=username;Password=password;Encrypt=true')
        const result = await sql.query`select * from mytable where id = ${value}`
        console.dir(result)
    } catch (err) {
        // error checks
    }
}

Or, use a configuration object to connect to the database:

const sql = require('mssql')
const sqlConfig = {
  user: process.env.DB_USER,
  password: process.env.DB_PWD,
  database: process.env.DB_NAME,
  server: 'localhost',
  pool: {
    max: 10,
    min: 0,
    idleTimeoutMillis: 30000
  },
  options: {
    encrypt: true, // for azure
    trustServerCertificate: false // change to true for local dev/self-signed certs
  }
}

async () => {
 try {
  await sql.connect(sqlConfig)
  const result = await sql.query`select * from mytable where id = ${value}`
  console.dir(result)
 } catch (err) {
  // ... error checks
 }
}

Where are the mssql docs?

The comprehensive documentation for mssql is available directly on the GitHub page of the project: git+https://github.com/tediousjs/node-mssql.git. This provides detailed sections on different features, functionalities, methods, and classes available in the npm package, along with examples and instructions for different scenarios.