← 返回
未分类 Key 中文

MSSQL

Execute SQL Server queries and export results as delimiter-separated text. Use when the user asks to fetch, insert, update, or manage data in Microsoft SQL S...
执行 SQL Server 查询并将结果导出为分隔符分隔的文本。适用于用户请求查询、插入、更新或管理 Microsoft SQL Server 数据时。
mohamed-hammane
未分类 clawhub v1.0.2 1 版本 100000 Key: 需要
★ 0
Stars
📥 593
下载
💾 2
安装
1
版本
#latest

概述

MSSQL

Run SQL Server queries using scripts/mssql_query.sh.

Quick start

  1. Ensure credentials exist at:

~/.openclaw/credentials/mssql.env

  1. Run a query:

bash skills/mssql/scripts/mssql_query.sh --query "SELECT TOP 20 name FROM sys.tables"

  1. Save to file:

bash skills/mssql/scripts/mssql_query.sh --query "SELECT TOP 100 * FROM dbo.MyTable" --out /tmp/mytable.dsv

Credentials format

Expected env vars in ~/.openclaw/credentials/mssql.env:

  • MSSQL_HOST
  • MSSQL_DB
  • MSSQL_USER
  • MSSQL_PASSWORD
  • Optional: MSSQL_PORT (default 1433), MSSQL_ENCRYPT (yes/no, default yes), MSSQL_TRUST_CERT (yes/no, default no), SQLCMD_BIN

The credential file path can be overridden with the MSSQL_ENV_FILE environment variable.

Permissions

Query permissions are controlled entirely at the SQL Server user level. The script does not impose any restrictions on query type — the database user's grants determine what is allowed.

Database reference map

Place your database map at references/DB_MAP.md inside this skill folder. This file tells the agent which databases, schemas, and tables to use and how they relate to each other.

See references/DB_MAP.example.md for the expected format.

Useful patterns

  • Run long query from file:

bash skills/mssql/scripts/mssql_query.sh --file /path/query.sql --out /tmp/out.dsv

  • Override database:

bash skills/mssql/scripts/mssql_query.sh --db OtherDB --query "SELECT TOP 10 * FROM dbo.Users"

  • Change delimiter:

bash skills/mssql/scripts/mssql_query.sh --query "SELECT ..." --delim ","

  • Increase timeout:

bash skills/mssql/scripts/mssql_query.sh --query "SELECT ..." --timeout 180

Output format

Output is delimiter-separated text, not RFC 4180 CSV. Fields are not quoted or escaped. This works well for structured numeric and short-text data. If your columns contain embedded delimiters, quotes, or newlines, the output may be malformed — choose a delimiter that does not appear in the data, or post-process the output.

Best practices

  • Prefer explicit columns over SELECT *.
  • Use TOP for exploratory samples.
  • Keep queries scoped to the user request.
  • Answer in business language by default; provide SQL details when requested.
  • Never print or expose credentials in responses.

Troubleshooting

  • sqlcmd not found -> install sqlcmd v18+ or set SQLCMD_BIN.
  • TLS/certificate issues on internal networks -> set MSSQL_TRUST_CERT=yes in your credentials file. The default is no (certificate validation enabled).

版本历史

共 1 个版本

  • v1.0.2 当前
    2026-05-03 05:17 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

PDF Report

mohamed-hammane
使用 Jinja2 和 WeasyPrint 从结构化 JSON 生成整洁的 A4 PDF 报告,适用于需要格式化 PDF 文档的场景,如分析摘要、数据报告等。
★ 0 📥 581

Excel Export

mohamed-hammane
从结构化JSON生成精美的.xlsx工作簿,支持多工作表、冻结表头、筛选、类型化列、公式、合计以及法国/摩洛哥格式。
★ 0 📥 459

IMAP SMTP Email

mohamed-hammane
使用本地 Node脚本通过 IMAP/SMTP 读取和发送邮件,适用于需要检查收件箱、获取邮件内容、搜索邮件、下载附件等场景。
★ 0 📥 451