How alaskaforever/mssql2csv works
mssql2csv is a small Go command-line utility: it loads database settings from .env, accepts SQL files as arguments, runs each query against SQL Server, and writes a same-basename CSV. The runtime is concentrated in main.go; the SQL files are selectable query inputs rather than separately orchestrated stages. The README documents the multi-file workflow. The sampled source does not show the contents of individual SQL files.
Main entry points: main.go Query Exporter · .env DB Configuration · ADkasutajad.sql AD Users Query · WinInstSoftware.sql Installed Software Query
Components 13
Runtime
- Query Exporter
main.go - DB Configuration
.env - CSV Output
SQL Queries
- AD Users Query
ADkasutajad.sql - Installed Software Query
WinInstSoftware.sql - Assets Query
assets.sql - Printers Query
local-printerid.sql - Networks Query
networks.sql - Switch Ports Query
switchports.sql - VM Guests Query
vm_guests.sql - Network Assets Query
vorguvarad.sql
Other components
- CLI User
- SQL Server
Connections 12
- CLI User → Query Exporter: runs with files
README.md - Query Exporter → DB Configuration: loads settings
main.go - Query Exporter → SQL Server: queries
main.go - Query Exporter → CSV Output: writes results
main.go - Query Exporter → AD Users Query: reads if supplied
README.md - Query Exporter → Installed Software Query: reads if supplied
README.md - Query Exporter → Assets Query: reads if supplied
README.md - Query Exporter → Printers Query: reads if supplied
README.md - Query Exporter → Networks Query: reads if supplied
README.md - Query Exporter → Switch Ports Query: reads if supplied
README.md - Query Exporter → VM Guests Query: reads if supplied
README.md - Query Exporter → Network Assets Query: reads if supplied
README.md