Azure-Samples / Azure-Samples/SQL-AI-samples

MSSQL MCP DescribeTable tool only works with SQL Server 2017 (14.x) and later

未關閉
#61 0 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
HTML
星號
331
分支
208
PR 合併指標
30 天內沒有已合併 PR

描述

MSSQL MCP DescribeTable tool fails with error

```json
{"success":false,"error":"Incorrect syntax near \u0027(\u0027."}
```

when used with an old SQL server version (or, in my case, a database with a compatibility level lower than 140).

This happens because the [STRING_AGG](https://learn.microsoft.com/en-us/sql/t-sql/functions/string-agg-transact-sql?view=sql-server-ver17) SQL function, which is used in the implementation of `DescribeTable`, was only introduced in SQL Server 2017 (14.x).

There are other approaches that accomplish the same thing and also work with older version of SQL server, but probably it's not worth it to introduce such a workaround for such old versions.

I was able to work around this issue by increasing the compatibility level of my local database:

```sql
alter database current set compatibility_level = 160;
```

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。