Skip to content

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

@christianpoletti

Description

@christianpoletti

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:

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions