14

I just freshly installed SQL Server Express 2014 via Chocolatey. The service is currently running.

When I run this inside my CMD or Powershell:

> sqlcmd -e -S .\SQLEXPRESS
1> sp_databases;
2>

I get no output, it just goes to the next prompt line.

However when I use this style, I do get output:

> sqlcmd -e -S .\SQLEXPRESS -Q "sp_databases;"
sp_databases;
DATABASE_NAME                                                                                                                    DATABASE_SIZE REMARKS

-------------------------------------------------------------------------------------------------------------------------------- ------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
master                                                                                                                                    7808 NULL

model                                                                                                                                     5312 NULL

msdb                                                                                                                                     37632 NULL

tempdb                                                                                                                                    2560 NULL

What could be the reason for this? I have no special configuration for the CMD or Powershell except some colour changes of the console.

1

1 Answer 1

24

Turns out I just needed to run GO at the end of each command. Silly.

Sign up to request clarification or add additional context in comments.

2 Comments

Didn't work for me. The number resets to 1, though, as in 1>
Didn't work for me too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.