If you run SQL scripts through sqlcmd - a deploy step, a data fix, a seed script, a pipeline that loads text into a table - sooner or later one of them prints this:
'Amount' scripting variable not defined.
Enter fullscreen mode
Exit fullscreen mode
The name in quotes changes; the cause doesn't. Somewhere in your script there is a $( followed by a name and a ) , and sqlcmd has read it as one of its own variables. Usually it's inside a string you meant literally: a price template, a shell command stored in a table, a blog post with a code sample in it. I hit it on this site, whose posts are inserted by a script that pipes generated SQL through sqlcmd - any post with a shell example like $(cygpath -w file) in it tripped over this.
The short fix: if the script doesn't use sqlcmd variables at all, run it with sqlcmd -x (or Invoke-Sqlcmd -DisableVariables in PowerShell). If it does use them, break the pattern inside the SQL text instead: write '$' + '(Amount)' or CHAR(36) + '(Amount)' .…