接続コマンド
sqlcmd -S servername -U userid -P password -d databasename
データベース一覧
USE databasename
GO
テーブル一覧
SELECT name FROM sysobjects WHERE xtype = 'U'
GO
タグ:SQL Server
日 | 月 | 火 | 水 | 木 | 金 | 土 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
sqlcmd -S servername -U userid -P password -d databasename
USE databasename
GO
SELECT name FROM sysobjects WHERE xtype = 'U'
GO
Scaffold-DbContext "Data Source=localhost\SQLEXPRESS;Initial Catalog=MyTestDB;User ID=****;Password=****" Microsoft.EntityFrameworkCore.SqlServer -Tables "UserTable","DivisionTable" -ContextDir DbContexts -OutputDir "DbContexts/Entities" -Force
オプションの補足説明
-Force 既存のファイル上書き
-Tablesテーブル名を指定。"TableA","TableB",...で複数指定可能。省略すると全テーブルに対して操作する。
-Context DBコンテキストのクラス名を指定すると、任意のDBコンテキストのクラス名を指定可能。省略するとDB名から自動生成。
"ConnectionStrings": {
"MyTestDB": "Data Source=localhost\\SQLEXPRESS;Initial Catalog=MyTestDB;User ID=****;Password=****"
}
using Microsoft.EntityFrameworkCore;
using MyWebApp.DbContexts;
services.AddDbContext<MyTestDBContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("MyTestDB")));
using MyWebApp.DbContexts;_context変数の宣言をする。
private readonly ILogger<HomeController> _logger;
private readonly MyTestDBContext _context; // 追加
public HomeController(ILogger<HomeController> logger, MyTestDBContext context /*追加*/)
{
_logger = logger;
_context = context; // 追加
}
var item = _context.UserTable.FirstOrDefault();
if (item != null)
{
ViewBag.mydata = item.Name;
}
<h1>こんにちは@(ViewBag.mydata)さん</h1>
ll
ssh -i secret.pem user@remoteHost
scp -i secret.pem ~/test.txt user@remoteHost:/tmp/
scp -i secret.pem user@remoteHost:/tmp/test.txt ~/
tar -xzvf sample.tgz
nohup jmeter/bin/jmeter -n -t jmeter_test.jmx -l jmeter_log.jtl > log.log &
zip -r archivename ./directoryname
chmod 777 targer.txt
chmod o-x targer.txt
chown root:root targer
du -h ~/
df -h
free -h
ps auw | grep name
tail -n 50 test.txt
head -n 50 test.txt
crontab -l
find ./ -name targetword