[ファイル] メニューの [オブジェクト エクスプローラを接続] をクリックします。
[サーバーへの接続] ダイアログ ボックスが表示されます。[サーバーの種類] ボックスに、最後に使用した種類が表示されます。
[データベース エンジン] を選択します。
[サーバー名] ボックスに、データベース エンジン インスタンスの名前を入力します。
[接続] をクリックします。
$ sqlcmd /?
Microsoft (R) SQL Server Command Line Tool
Version 9.00.3042.00 NT INTEL X86
Copyright (C) Microsoft Corporation. All rights reserved.
使用法: Sqlcmd [-U login id] [-P password]
[-S server] [-H hostname] [-E trusted connection]
[-d use database name] [-l login timeout] [-t query timeout]
[-h headers] [-s colseparator] [-w screen width]
[-a packetsize] [-e echo input] [-I Enable Quoted Identifiers]
[-c cmdend] [-L[c] list servers[clean output]]
[-q "cmdline query"] [-Q "cmdline query" and exit]
[-m errorlevel] [-V severitylevel] [-W remove trailing spaces]
[-u unicode output] [-r[0|1] msgs to stderr]
[-i inputfile] [-o outputfile] [-z new password]
[-f <codepage> | i:<codepage>[,o:<codepage>]] [-Z new password and exit]
[-k[1|2] remove[replace] control characters]
[-y variable length type display width]
[-Y fixed length type display width]
[-p[1] print statistics[colon format]]
[-R use client regional setting]
[-b On error batch abort]
[-v var = "value"...] [-A dedicated admin connection]
[-X[1] disable commands, startup script, enviroment variables [and exit]]
[-x disable variable substitution]
[-? show syntax summary]
別のコンピュータからの TCP/IP 接続を有効にするには
SQL Server が特定のポートでリッスンするよう構成するには
Windows ファイアウォールでポートを開くには
[スタート] メニューで、[コントロール パネル] をクリックします。
コントロール パネルで、[ネットワークとインターネット接続] をクリックして、[Windows ファイアウォール] を開きます。
[Windows ファイアウォール] で、[例外] タブをクリックして、[ポートの追加] をクリックします。
[ポートの追加] ダイアログ ボックスの [名前] ボックスに、「SQL Server <instanceName>」と入力します。
[ポート番号] ボックスに、データベース エンジン インスタンスのポート番号を入力します。既定のインスタンスの場合は「1433」を使用します。名前付きインスタンスを構成する場合や、前の作業で固定ポートを構成した場合は、「1500」と入力します。[TCP] が選択されていることを確認して、[OK] をクリックします。
SampleData base
Express Editions 用サンプル データベースのインストールC:\SQL Server 2000 Sample Databases>sqlcmd -E -S .\SQLEXPRESS -i instnwnd.sql
データベース コンテキストが 'master' に変更されました。
データベース コンテキストが 'Northwind' に変更されました。
C:\SQL Server 2000 Sample Databases>sqlcmd -E -S .\SQLEXPRESS -i instpubs.sql
データベース コンテキストが 'master' に変更されました。
Beginning InstPubs.SQL at 25 10 2007 22:24:26:580 ....
Creating pubs database....
データベース コンテキストが 'pubs' に変更されました。
Now at the create table section ....
Now at the create trigger section ...
Now at the inserts to authors ....
Now at the inserts to publishers ....
Now at the inserts to pub_info ....
Now at the inserts to titles ....
Now at the inserts to titleauthor ....
Now at the inserts to stores ....
Now at the inserts to sales ....
Now at the inserts to roysched ....
Now at the inserts to discounts ....
Now at the inserts to jobs ....
Now at the inserts to employee ....
Now at the create index section ....
Now at the create view section ....
Now at the create procedure section ....
データベース コンテキストが 'master' に変更されました。
Ending InstPubs.SQL at 25 10 2007 22:24:29:480 ....Microsoft Windows [Version 6.0.6000]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.
C:\Users\smnb\Documents\delthis>sqlcmd -S .\SQLEXPRESS
1> exit
C:\Users\smnb\Documents\delthis>
BASH!!! $ sqlcmd -S VISTA\\SQLEXPRESS -E
1> exit