mssql-cmd » Use cases » Run AI-generated SQL
Download mssql-cmd Free Trial » Buy mssql-cmd Now »
Ask an assistant to clean up old test rows in SQL Server, reshape a table, or move data between two schemas, and you get a SQL script in a few seconds. Writing it was never the hard part. The hard part is where it has to run - a production or customer server where you cannot install a client, a step that has to run on a schedule, and a result somebody can check afterwards.
And SQL written from a description reads plausibly even when it is wrong, which is exactly why it should be run somewhere its effect is visible, not pasted into a production console by hand and hoped over.
source script.sql interactively, with the results printed to the terminal.mssql-cmd dsn="user:pass@host:1433/db" task=source sqlfile=script.sql
The result is text you can keep, so a change made by a generated script can be shown to somebody afterwards - which is what makes it auditable, and what a chat window cannot give you.
An assistant is good at writing the SQL; it cannot be responsible for running it against your database. That half needs a client that connects where a client cannot be installed, runs the script on demand, and leaves a result behind. That is the half mssql-cmd provides - the script is still yours to read and own.
UPDATE has the WHERE clause it should.The script itself: run SQL scripts, execute a command. Non-interactive use: batch mode, shell scripts. On a server with nothing installed: portable copy. The same job, interactively: interactive mode.