Command line parameters – Case sensitive!

A quick post, but about something that might save you some good time when you need it the most!

SQL Server has some actions that might be performed by command line, be it with utilities like SQLCMD, or other situations like when you start SQL Server service from a command prompt.

An interesting thing about these commands is that, since now we are working command line, many of the parameters utilized are CASE SENSITIVE and we, so used to work with GUIs, end up forgetting this.

An interesting example (that I think that Microsoft should have some pattern on) is the s/S parameter. SQLCMD utility uses it to specify the server we want to connect. It is also used when you want to start SQL Server service from command line.

When using SQLCMD utility, you may use it this way:

SQLCMD -S server\instance -U user -P password (capital S!)

When starting the SQL Server service from the command line, you may use it this way:

start sqlservr.exe -m -s INSTANCE (tiny s!)

So, when working with command line, pay attention to the parameters you use, since the error messages returned (when there is one) in most cases are not so clear!

For example, when you are tring to start SQL Service from the command line, if you use -S (capital S) it will ignore the parameter and show you some error message telling you something about the MSSQLSERVER instance. If you don’t pay close attention to the message you may not even notice the problem!

So the tip is, make sure you ever check the case of the parameter you are using when using command line, it may save you some time and avoid problems!

Esse post foi publicado em Artigos. Bookmark o link permanente.

Deixe uma resposta

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logotipo do WordPress.com

Você está comentando utilizando sua conta WordPress.com. Sair / Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair / Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair / Alterar )

Foto do Google+

Você está comentando utilizando sua conta Google+. Sair / Alterar )

Conectando a %s