Skip to content

:SETVAR with a comment on the same line throws syntax error #546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
BradKnowles opened this issue Aug 5, 2024 · 1 comment · Fixed by #548
Closed

:SETVAR with a comment on the same line throws syntax error #546

BradKnowles opened this issue Aug 5, 2024 · 1 comment · Fixed by #548
Assignees

Comments

@BradKnowles
Copy link

If you have a line like so

:setvar RedeployJobs "YES" -- "YES" to redeploy jobs, "NO" to skip redeploy

A syntax error results

Sqlcmd: Error: Syntax error at line X near command ':SETVAR'.
Sqlcmd: Error: Syntax error at line X near command ':SETVAR'.
@shueybubbles shueybubbles self-assigned this Aug 5, 2024
@LarnuUK
Copy link

LarnuUK commented Aug 21, 2024

Huh, I was about to report a similar problem in regards to [:]QUIT. In sqlcmd ODBC, the following will cause QUIT to work:

PRINT 1;
:QUIT --This is a test

So, for example, sqlcmd ODBC version 15.0.1300.359 won't provide an output. Using sqlcmd Go v1.8.0, however, you get similar to the OP:

Sqlcmd: Error: Syntax error at line 2 near command 'QUIT'.
1

Enabling the -b switch causes the error to be repeated:

Sqlcmd: Error: Syntax error at line 2 near command 'QUIT'.
Sqlcmd: Error: Syntax error at line 2 near command 'QUIT'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants