2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【備忘録】sqlcmd

Posted at

slqcmdとは

Microsoft SQL Serverに対して、
コマンドラインから操作を行うためのツール

sqlcmdを使って、SQLクエリやスクリプト実行をして、データ取得や更新をかけたり、
バッチファイルにまとめることも可能となります。

インストール

Microsoftの公式サイトからダウンロードが可能です。

DBに接続

sqlcmd -S <サーバー名> -U <ユーザー名> -P <パスワード>

接続が成功すると、1>というプロンプトが表示されます。

クエリの実行

sqlcmd -S <サーバー名> -U <ユーザー名> -P <パスワード> -Q "SELECT * FROM <テーブル名>"

まとめ

sqlcmdはバッチファイルの作成などに、使用すると便利かと思いますが、
SQL Serverに接続できるかの確認で使用する際に使ってみました。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?