How to call an Ollama-based AI text embeddings model from SQL Server 2025


 

In the first article of this series, I explained how to install and configure Ollama to host text embeddings models locally. I also demonstrated how to install Caddy as a proxy to allow SQL Server to use Ollama via https-based calls. In this article, I’ll show you how to make use of this at the SQL Server end.

No time to read? Here’s a quick overview:
To generate text embeddings in SQL Server using a locally hosted Ollama model, enable REST endpoints with sp_configure, define the model once using CREATE EXTERNAL MODEL, then call AI_GENERATE_EMBEDDINGS whenever you need a vector. This