Skip to content
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

-b option is not working in go-sqlcmd #98

Closed
christianpoletti opened this issue Jun 21, 2022 · 0 comments · Fixed by #99
Closed

-b option is not working in go-sqlcmd #98

christianpoletti opened this issue Jun 21, 2022 · 0 comments · Fixed by #99
Assignees

Comments

@christianpoletti
Copy link

I´m trying to use the -b option in go-sqlcmd, and it always returns a rc:1 with NO stderr.

For recreating the scenario, I have this T-SQL sentence inside table_creation.sql:
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE NAME = 'ANSIBLE_DB_CICD' AND TYPE = 'U') BEGIN CREATE TABLE ANSIBLE_DB_CICD (ID INT IDENTITY(1,1), COMMENT VARCHAR (250)) END

In below image, you can see that I receive a rc: 1 if I´m using -b option, and I receive rc: 0 when I´m not using it, always with NO stderr:
image

I this CentOS VM where I have the go-sqlcmd installed, I also have the regular sqlcmd (the one that´s part of command-line tools). So, I did some testing with a "bad" script, testing both tools, and noticed that the behavior is different.

image

As you can see, when running the go-sqlcmd (/user/bin/sqlcmd) with -b option and a "bad" T-SQL, I receive rc:1 and nothing in the stderr. However, when doing the same with the regular sqlcmd (/opt/mssql-tools/bin/sqlcmd), I receive rc:1 but also some information about the error in the stderr:

@stuartpa stuartpa self-assigned this Jun 21, 2022
@stuartpa stuartpa linked a pull request Jun 22, 2022 that will close this issue
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.

2 participants