Simple SQL escape and format library for T-SQL (Microsoft SQL Server), currently at version 1.0.1. Inspired by the popular sqlstring library for MySQL, tsqlstring provides functions to safely escape values and format queries using placeholders. It supports numbers, booleans, dates, buffers, strings, arrays, nested arrays, objects with toSqlString method, and null/undefined. Notably, it does not support NaN or Infinity as T-SQL lacks support for these. The library is released under the MIT license and is actively maintained.
npm install tsqlstringNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates escaping user input with placeholders and direct escape to prevent SQL injection.
Ensure values are not NaN or Infinity before passing to escape; convert to NULL if needed.
Use ? placeholders exclusively when using format; for named parameters, use manual escaping.
Avoid using ? in comments or string literals; escape literal ? if needed.
Use correct import: import SqlString from 'tsqlstring' or const SqlString = require('tsqlstring')Run: npm install tsqlstring
Use: import { format } from 'tsqlstring'No dependency data recorded yet.