There's some logic in sql-string.js which does this for the SQLite dialect - will modify the logic to include mssql