LoginSignup
6
6

More than 5 years have passed since last update.

SQL Server LocalDBであれこれの備忘録

Last updated at Posted at 2017-05-28

とりあえず、まだよくわからないが、備忘録。

データベース作成方法

インスタンス名の列挙
C:\Users\kei>sqllocaldb info
MSSQLLocalDB
インスタンスのパイプ名取得
C:\Users\kei>sqllocaldb info MSSQLLocalDB
名前:               mssqllocaldb
バージョン:         13.0.1601.5
共有名:
所有者:             XXX-PC\kei
自動作成:        はい
状態:              実行中
前回の開始時刻:    2017/05/27 20:22:13
インスタンス パイプ名: np:\\.\pipe\XXXXXXXXXXXXX\tsql\query
インスタンスへ接続
C:\Users\kei>sqlcmd -S np:\\.\pipe\XXXXXXXXXXXXXX\tsql\query
1>
データベース一覧表示

goを付ける

select name from sys.databases;
go
データベースの作成
create database testdb
go

データベースの保存場所

VisualStudioのサーバーエクスプローラーでデータベースに接続する際に、保存場所を特定する必要がある。
なぜか、保存場所はデータベース作成方法によりばらつきがあるみたい。

SSMS(SQL Server Management Studio)を使用してデータベース作った場合

C:\Users\ユーザー名\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\インスタンス名

sqlcmdを使用してデータベースを作った場合

C:\Users\ユーザー名\直下

6
6
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
6
6