A standalone SQL Server (MSSQL) interactive CLI client for Go applications.
- 🚀 Full T-SQL support
- 📝 GO batch separator support
- 🔧 System stored procedures
- ⏱️ Query timing
- 💾 Connection pooling
- 📊 Table format output
go get github.com/binrchq/mssql-clipackage main
import (
"log"
"os"
mssqlcli "github.com/binrchq/mssql-cli"
)
func main() {
cli := mssqlcli.NewCLI(
os.Stdin,
"localhost",
1433,
"sa",
"password",
"mydb",
)
if err := cli.Connect(); err != nil {
log.Fatal(err)
}
defer cli.Close()
if err := cli.Start(); err != nil {
log.Fatal(err)
}
}- All standard SQL Server T-SQL syntax
USE <database>- Switch database
sp_help [table]- Show table infosp_databases- List databasessp_tables- List tablessp_columns <table>- List columnssp_who- Show connections
Use GO to execute a batch of T-SQL statements.
help- Show helpexit,quit- Exittiming- Toggle timingclear,cls- Clear screen
- Go 1.21 or higher
- SQL Server 2016 or higher
- github.com/denisenkom/go-mssqldb - SQL Server driver
- github.com/chzyer/readline - Readline library
MIT License - see LICENSE file for details.
Maintained by binrc.
- mysql-cli - MySQL CLI
- postgres-cli - PostgreSQL CLI