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

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

Aperta
#61 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
HTML
Stelle
331
Fork
208
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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;
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start at the MSSQL MCP DescribeTable implementation and inspect the query using STRING_AGG. Reproduce the failure against a database with compatibility level below 140, then determine whether the tool should support that level and verify the chosen behavior against an older SQL Server compatibility setting.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
sql
Ambito
databases
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.