| title | AI_FIX_GRAMMAR (Transact-SQL) | ||
|---|---|---|---|
| description | The AI_FIX_GRAMMAR function corrects grammar in input text. | ||
| author | WilliamDAssafMSFT | ||
| ms.author | wiassaf | ||
| ms.reviewer | jovanpop | ||
| ms.date | 06/10/2026 | ||
| ms.service | sql | ||
| ms.subservice | t-sql | ||
| ms.topic | reference | ||
| ms.custom |
|
||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
||
| monikerRange | =fabric |
[!INCLUDE fabric-se-dw]
The AI_FIX_GRAMMAR function corrects grammar and improves sentence quality for the input text.
Note
AI_FIX_GRAMMARis in preview.AI_FIX_GRAMMARis available only in [!INCLUDE fabric-se-short] and [!INCLUDE fabric-dw].
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
AI_FIX_GRAMMAR ( text )
An expression of a character type, for example nvarchar, varchar, nchar, or char.
Returns nvarchar(max) with corrected text.
AI functions return NULL if the AI model can't process the text. Common reasons include:
- Responsible AI rules block inappropriate content in the input text.
- Input text exceeds token limits. The current model supports up to 15 KB of text.
SELECT ai_fix_grammar('Th room are clean and staff were nice') AS fixed_text;Expected result: The rooms are clean, and the staff were nice.
UPDATE dbo.hotel_reviews
SET review_text = ISNULL(ai_fix_grammar(review_text), review_text);