how to execute SQL statements in command prompt (CMD)
cmd, sql, sql-server
Solution
You are looking for the `sqlcmd` utility lets you enter Transact-SQL statements, system procedures, and script files at the command prompt
sqlcmd -U myLogin -P myPassword -S MyServerName -d MyDatabaseName
-Q "query"
Refer this
Edit: The OP said The `sqlcmd.exe` file is available in the installation path `C:\Program Files\Microsoft SQL Server\110\Tools\Binn`
You are executing with `C:\Users>` make the path to `C:\Program Files\Microsoft SQL Server\110\Tools\Binn` and execute `sqlcmd` or add the `sqlcmd` path `(C:\Program Files\Microsoft SQL Server\110\Tools\Binn)` to system `PATH`
Problem
how to execute SQL statements in command prompt (CMD), I'm using SQL Server 2012 in windows 8 OS. I have tried sqlplus and sqlcmd, both are giving error "