惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cisco Talos Blog
Cisco Talos Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
博客园 - Franky
Hugging Face - Blog
Hugging Face - Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
博客园 - 司徒正美
N
News and Events Feed by Topic
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
WordPress大学
WordPress大学
博客园 - 三生石上(FineUI控件)
Help Net Security
Help Net Security
N
News and Events Feed by Topic
O
OpenAI News
L
LangChain Blog
F
Full Disclosure
A
About on SuperTechFans
The GitHub Blog
The GitHub Blog
GbyAI
GbyAI
Cloudbric
Cloudbric
W
WeLiveSecurity
Application and Cybersecurity Blog
Application and Cybersecurity Blog
罗磊的独立博客
Attack and Defense Labs
Attack and Defense Labs
PCI Perspectives
PCI Perspectives
TaoSecurity Blog
TaoSecurity Blog
AI
AI
有赞技术团队
有赞技术团队
酷 壳 – CoolShell
酷 壳 – CoolShell
C
CXSECURITY Database RSS Feed - CXSecurity.com
C
Cisco Blogs
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Apple Machine Learning Research
Apple Machine Learning Research
C
CERT Recently Published Vulnerability Notes
T
The Exploit Database - CXSecurity.com
T
Threatpost
P
Palo Alto Networks Blog
G
GRAHAM CLULEY
Last Week in AI
Last Week in AI
雷峰网
雷峰网
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
C
Cyber Attacks, Cyber Crime and Cyber Security
博客园 - 聂微东
P
Proofpoint News Feed
Latest news
Latest news
S
SegmentFault 最新的问题
J
Java Code Geeks
T
Threat Research - Cisco Blogs
H
Help Net Security
P
Privacy International News Feed

puzzle9 blog

webdav - puzzle9 blog parser video tencent - puzzle9 blog wstunnel - puzzle9 blog rclone - puzzle9 blog debian 转换为 pve - puzzle9 blog nfs - puzzle9 blog caddy - puzzle9 blog webhookd 发布 - puzzle9 blog win 系统部署 by WinRM - puzzle9 blog hl7 初探 - puzzle9 blog realm 端口转发 - puzzle9 blog airflow - puzzle9 blog 租房啊 - puzzle9 blog cr660x 路由器研究 - puzzle9 blog hs8145v 光猫研究 - puzzle9 blog dae 跨墙 - puzzle9 blog ZeroTier 打洞 🕊 - puzzle9 blog rathole 穿透 - puzzle9 blog WireGuard 组网 - puzzle9 blog
mysql 迁移到 mssql - puzzle9 blog
2025-07-02 · via puzzle9 blog
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
$mssql_db = DB::connection('mssql');

$local_database = config('database.connections.mariadb.database');

$local_tables = DB::connection('mariadb')
->table('information_schema.TABLES')
->where('TABLE_SCHEMA', $local_database)
->pluck('table_comment', 'table_name');

$local_columns = DB::connection('mariadb')
->table('information_schema.COLUMNS')
->select('table_name', 'column_name', 'column_comment')
->where('TABLE_SCHEMA', $local_database)
->get()
->groupBy('table_name');

foreach ($local_columns as $table_name => $table_columns) {
try {
$mssql_db->table($table_name)->exists();
} catch (\Exception) {

continue;
}

$table_comment = $local_tables[$table_name];

$mssql_db->statement("IF ((SELECT COUNT(*) FROM ::fn_listextendedproperty('MS_Description',
'SCHEMA', 'dbo',
'TABLE', ?, NULL, NULL)) > 0)
EXEC sp_updateextendedproperty
'MS_Description', ?,
'SCHEMA', 'dbo',
'TABLE', ?
ELSE
EXEC sp_addextendedproperty
'MS_Description', ?,
'SCHEMA', 'dbo',
'TABLE', ?", [
$table_name,
$table_comment,
$table_name,
$table_comment,
$table_name,
]);

foreach ($table_columns as $column) {
$column_name = $column->column_name;

$column_comment = $column->column_comment;
$mssql_db->statement("IF ((SELECT COUNT(*) FROM ::fn_listextendedproperty('MS_Description',
'SCHEMA', 'dbo',
'TABLE', ?,
'COLUMN', ?)) > 0)
EXEC sp_updateextendedproperty
'MS_Description', ?,
'SCHEMA', 'dbo',
'TABLE', ?,
'COLUMN', ?
ELSE
EXEC sp_addextendedproperty
'MS_Description', ?,
'SCHEMA', 'dbo',
'TABLE', ?,
'COLUMN', ?", [
$table_name,
$column_name,
$column_comment,
$table_name,
$column_name,
$column_comment,
$table_name,
$column_name,
]);
}
}