| title | ALTER EXTERNAL MODEL (Transact-SQL) | |||
|---|---|---|---|---|
| description | ALTER EXTERNAL MODEL (Transact-SQL) for altering an external model object that contains the location, authentication method, and purpose of an AI model inference endpoint. | |||
| author | jettermctedder | |||
| ms.author | bspendolini | |||
| ms.reviewer | randolphwest | |||
| ms.date | 10/14/2025 | |||
| ms.service | sql | |||
| ms.subservice | t-sql | |||
| ms.topic | reference | |||
| ms.custom |
|
|||
| f1_keywords |
|
|||
| helpviewer_keywords |
|
|||
| dev_langs |
|
|||
| monikerRange | =azuresqldb-current || >=sql-server-ver17 || >=sql-server-linux-ver17 || =fabric-sqldb |
[!INCLUDE sqlserver2025-asdb-fabricsqldb]
Alters an external model object.
ALTER EXTERNAL MODEL external_model_object_name
SET
( LOCATION = '<prefix>://<path> [ :<port> ] '
, API_FORMAT = '<OpenAI , Azure OpenAI , etc>'
, MODEL_TYPE = EMBEDDINGS
, MODEL = 'text-embedding-ada-002'
[ , CREDENTIAL = <credential_name> ]
[ , PARAMETERS = ' { "valid":"JSON" } ' ]
);
Specifies the user-defined name for the external model. The name must be unique within the database.
Provides the connectivity protocol and path to the AI model inference endpoint.
The API message format for the AI model inference endpoint provider. Accepted values are Azure OpenAI, OpenAI, and Ollama.
The type of model being accessed from the AI model inference endpoint location. Accepted value is EMBEDDINGS.
The specific model hosted by the AI provider. For example, text-embedding-ada-002, text-embedding-3-large, or o3-mini.
Indicate which DATABASE SCOPED CREDENTIAL object is used with the AI model inference endpoint.
A valid JSON string that contains parameters to be appended to the AI model inference endpoint request message. For example:
'{ "dimensions": 1536 }'
Only single external model object can be modified at a time. Concurrent requests to modify the same external model object causes one statement to wait. However, different external model objects can be modified at the same time. This statement can run concurrently with other statements.
This example alters the EXTERNAL MODEL named myAImodel, and changes the MODEL parameter.
-- Alter an external model
ALTER EXTERNAL MODEL myAImodel
SET
(
MODEL = 'text-embedding-3-large'
);