How do I run a SQL query from the command line?

How do I run a SQL query from the command line?
Answer
Start the sqlcmd utility and connect to a default instance of SQL Server
  1. On the Start menu click Run. In the Open box type cmd, and then click OK to open a Command Prompt window. …
  2. At the command prompt, type sqlcmd.
  3. Press ENTER. …
  4. To end the sqlcmd session, type EXIT at the sqlcmd prompt.
 

Tìm kiếm

Back
Top