Sample Header Ad - 728x90

SQLCMD fails if -c; is specified in parameters on SQL Server 2019

2 votes
2 answers
835 views
The following sqlcmd fails with no error and no output, just returns silently.
-U dbuser -d dbname -w 255 -h-1 -P mypassword -S dbserver -Q "ALTER TABLE xyz ADD abcd NUMERIC(1)" -c;
While it works fine without the -c; argument
-U dbuser -d dbname -w 255 -h-1 -P mypassword -S dbserver -Q "ALTER TABLE xyz ADD abcd NUMERIC(1)"
This parameter has been there since before 2005, with OSQL, then recently (less than a year ago) we replaced OSQL with SQLCMD. And now we have discovered that one of our install scripts is not executing and it has come down to this -c; argument. Also, I am testing on SQL Server 2019. I asked someone to execute the same scripts on a SQL Server 2008 and there the SQLCMD is working with the -c; parameter. I have even tried specifying : and a few other characters instead of ; to no avail. How should this parameter be used? And if it is not recommended or not supported to use it any more, then please point to any documentation/bug report/release notes.
Asked by Ozair Kafray (131 rep)
Mar 2, 2022, 06:05 PM
Last activity: Mar 9, 2022, 04:28 PM