2

I am using SQL Server 2014 SP2 with AG, running this command:

sqlcmd -S ABC-ISELL -E -d ABP_SFA_BMB -K ReadOnly

Where ABC-ISELL is the listener name, I am getting this error:

Sqlcmd: 'KReadOnly': Unknown Option. Enter '-?' for help.

sqlcmd -? shows there is no -K option, it`s just this:

[-k[1|2] remove[replace] control characters]

What could be wrong here?

3

One needs to use recent enough a version of sqlcmd. The parameter for application intent is -K. Note that sqlcmd's parameters are case sensitive, which is uncommon in Windows environment.

To check sqlcmd's version, run it with -? parameter. Like so,

C:\>sqlcmd -?
Microsoft (R) SQL Server Command Line Tool
Version 14.0.1000.169 NT
Copyright (C) 2017 Microsoft Corporation. All rights reserved.

usage: Sqlcmd            [-U login id]          [-P password]
...
[-k[1|2] remove[replace] control characters]
...
-K application intent

For updated version, check Microsoft's product documentation, there's a link to Download center.

  • That instance was SQL 2008 R2 upgraded to 2014 SP2, database version now is: 12.0.5571, still showing this!! C:\Windows\system32>sqlcmd -? Microsoft (R) SQL Server Command Line Tool Version 10.50.6000.34 NT x64 Which is weird! – hany Jul 30 '18 at 14:31
0

That instance was SQL 2008 R2 upgraded to 2014 SP2, database version now is: 12.0.5571, still showing this!!

C:\Windows\system32>sqlcmd -? Microsoft (R) SQL Server Command Line Tool Version 10.50.6000.34 NT x64

I already restarted the service & rebooted the server, same issue.

Also installed Command Line Utilities 14.0 for SQL Server, same issue.

Which is weird! Any advise?

  • Looks like the old version is in path before the new one. Look in location like C:\Program Files\Microsoft SQL Server\140\Tools\Binn for the new version. – vonPryz Jul 30 '18 at 20:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.