一键导入
sqlserver-schema-sync
Compare two SQL Server databases and sync missing tables and columns from source to target using sqlcmd and a Python script.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Compare two SQL Server databases and sync missing tables and columns from source to target using sqlcmd and a Python script.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
通过 Maven profiles 构建同时支持 javax.servlet-api 和 jakarta.servlet-api 的双版本 JAR,包含构建目录切换、finalName 自定义、依赖 jar 复制重命名
Architecture and implementation patterns for the AI API proxy/gateway module (switchproxy) that converts between OpenAI/Anthropic/Responses API formats, with IP access control, key-based auth, multi-host listening, HTML status page, Web admin UI, and tool config export
emp-script-ai 及其下游项目(travelagent、pf2023)所用 AI Mode XML schema 的撰写参考。覆盖 `<mode>` / `<step>` / `<prompt>` / `<apis>` / `<sqls>` / `<actions>` / `<paramChecks>` / `<ui>` 各块结构、prompt 数据源(sqlRef / api / action / CDATA)、函数调用 prompt(`apisCheck`)、URL / 请求占位符、输出自定义标签(`<day>`、`<rq>`、`<cid>`、`<enj>`、`<id>`、`<num>`、`<sersday>`、`<prices>`、`<gn>`)以及 step 控制属性(`innerCall`、`validateParams`、`multiOnlyUserMsg`、`action`、`actionSqlRef`)。
Debugging SSE streaming failures after refactoring AI provider code, focusing on JSON null-safety and field ordering
Setting up integrationTest framework with HSQLDB in-memory database and real AI APIs for emp-script-ai
Procedure for adding a new AI provider to emp-script-ai (Java library wrapping multiple LLM providers via OpenAI-compatible interfaces)
| name | sqlserver-schema-sync |
| description | Compare two SQL Server databases and sync missing tables and columns from source to target using sqlcmd and a Python script. |
| source | auto-skill |
| extracted_at | 2026-06-17T02:31:14.932Z |
Compare two SQL Server databases on the same server and generate SQL to add missing tables and columns to the target database.
sqlcmd installed (check with which sqlcmd)python3 available for script generationUse sqlcmd with cross-database INFORMATION_SCHEMA queries to find tables in the source that don't exist in the target:
sqlcmd -S <server> -U <user> -P '<password>' -d <source_db> -W -h -1 -s"," -o /tmp/create_tables.csv -Q "
SELECT
c.TABLE_NAME, c.COLUMN_NAME, c.DATA_TYPE,
c.CHARACTER_MAXIMUM_LENGTH, c.NUMERIC_PRECISION, c.NUMERIC_SCALE,
c.IS_NULLABLE, c.COLUMN_DEFAULT, c.ORDINAL_POSITION
FROM <source_db>.INFORMATION_SCHEMA.COLUMNS c
WHERE c.TABLE_NAME IN (
SELECT b.TABLE_NAME FROM <source_db>.INFORMATION_SCHEMA.TABLES b
WHERE b.TABLE_TYPE='BASE TABLE'
AND NOT EXISTS (
SELECT 1 FROM <target_db>.INFORMATION_SCHEMA.TABLES a
WHERE a.TABLE_NAME = b.TABLE_NAME AND a.TABLE_TYPE='BASE TABLE'
)
)
ORDER BY c.TABLE_NAME, c.ORDINAL_POSITION
"
Find columns in shared tables that exist in source but not in target:
sqlcmd -S <server> -U <user> -P '<password>' -d <source_db> -W -h -1 -s"," -o /tmp/alter_columns.csv -Q "
SELECT
b.TABLE_NAME, b.COLUMN_NAME, b.DATA_TYPE,
b.CHARACTER_MAXIMUM_LENGTH, b.NUMERIC_PRECISION, b.NUMERIC_SCALE,
b.IS_NULLABLE, b.COLUMN_DEFAULT, b.ORDINAL_POSITION
FROM <source_db>.INFORMATION_SCHEMA.COLUMNS b
WHERE EXISTS (
SELECT 1 FROM <target_db>.INFORMATION_SCHEMA.TABLES a
WHERE a.TABLE_NAME = b.TABLE_NAME AND a.TABLE_TYPE='BASE TABLE'
)
AND NOT EXISTS (
SELECT 1 FROM <target_db>.INFORMATION_SCHEMA.COLUMNS c
WHERE c.TABLE_NAME = b.TABLE_NAME AND c.COLUMN_NAME = b.COLUMN_NAME
)
ORDER BY b.TABLE_NAME, b.ORDINAL_POSITION
"
Write a Python script that:
-h -1)varchar(-1) / nvarchar(-1) → varchar(max) / nvarchar(max)numeric(p,s) / decimal(p,s) → keep precision/scalentext, text, geography, money, bit, datetime → use as-isCREATE TABLE statements wrapped in IF NOT EXISTS guardsALTER TABLE ADD COLUMN statements wrapped in IF NOT EXISTS guardsDEFAULT constraints from COLUMN_DEFAULT columnUSE <target_db> and GO batch separatorssqlcmd -S <server> -U <user> -P '<password>' -d <target_db> -i /tmp/sync_schema.sql
Run the same comparison queries again to confirm 0 missing tables and 0 missing columns:
sqlcmd -S <server> -U <user> -P '<password>' -d <target_db> -W -h -1 -Q "
SELECT COUNT(*) AS missing_tables FROM (
SELECT b.TABLE_NAME FROM <source_db>.INFORMATION_SCHEMA.TABLES b
WHERE b.TABLE_TYPE='BASE TABLE'
AND NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES a WHERE a.TABLE_NAME = b.TABLE_NAME AND a.TABLE_TYPE='BASE TABLE')
) t
"
-h -1 with sqlcmd to suppress column headers (cleaner CSV parsing)-W to trim trailing spaces-s"," for comma delimiterCOLUMN_DEFAULT values from INFORMATION_SCHEMA include parentheses, e.g. ((0)), ('text'), (getdate()) — use them as-is in DEFAULT clausesSTRING_AGG, use cross-database INFORMATION_SCHEMA references--max-rows or remove the default 200-row limit