I suggest you ...

SQLCMD Unexplained behaviour returning output starting with square brackets

complete explanation at https://social.msdn.microsoft.com/Forums/sqlserver/en-US/b0c08c5d-a6aa-4ec7-9b54-87807cf81548/sql-server-2012-sqlcmd-unexplained-behaviour-returning-output-containing-square-brackets-?forum=sqltools

Basically, SQLCMD does not behave the same way since SQL 2012 when a message starts with an opening bracket.
The following command returns an empty string when previous version returned the entire text:
sqlcmd -b -E -S -Q "RAISERROR('[A][B][C]',10,1)"
this one removes the firs value between brackets:
sqlcmd -b -E -S -Q "RAISERROR('[A] [B][C]',10,1)"

29 votes
Vote
Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)
You have left! (?) (thinking…)
StefDBA shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

0 comments

Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)
Submitting...

Feedback and Knowledge Base