Running Scripts with the sqlcmd Utility
Applies to SQL Server 2019, 2022 and 2025. The sqlcmd utility is the plain command-line way to run T-SQL against SQL Server. I mostly use it for scripts that run on a schedule: from Windows Task Scheduler, a SQL Agent CmdExec step, a deployment pipeline or a Linux cron job. It’s simple to start with,…