Skip to content

Document Azure SQL Database limitation: vector indexes in stored procedures#62

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/fix-stored-procedure-error
Draft

Document Azure SQL Database limitation: vector indexes in stored procedures#62
Copilot wants to merge 4 commits intomainfrom
copilot/fix-stored-procedure-error

Conversation

Copy link
Contributor

Copilot AI commented Jan 29, 2026

Creating DiskANN vector indexes inside stored procedures fails on Azure SQL Database with DBCC TRACEON permission errors. The DiskANN build process requires internal operations not permitted in stored procedure contexts.

Changes

  • native-vector-search.md: Added "Known Issue" section with error reproduction, root cause, and 4 workarounds
  • sql-server-2025-setup.md: Added limitation callout in vector index section
  • docs/README.md: Added upfront warning in Getting Started

Error Example

CREATE PROCEDURE vector_sample AS
BEGIN
    CREATE VECTOR INDEX IX_Products_Embedding 
    ON Products(Embedding)
    WITH (METRIC = 'cosine');
END;
Msg: 2571 - User 'dbo' does not have permission to run DBCC TRACEON.
Msg: 42234 - DiskANN vector index build failed with internal error 200.

Workarounds Documented

  1. Direct execution (recommended): Run CREATE VECTOR INDEX statements outside stored procedures
  2. SQL generation utility: Query to generate index DDL for manual execution using CONCAT and sys.types
  3. Migration scripts: Separate schema deployment scripts
  4. Self-hosted SQL Server 2025: Where restrictions may not apply

Best practice: Maintain vector index creation in dedicated deployment scripts executed as part of database migration pipelines.

Original prompt

This section details on the original issue you should resolve

<issue_title>Stored procedure & Vector Indexes</issue_title>
<issue_description>Azure SQL Database on Central US region.

If you take some of the SQL presented in these samples and put them inside a SP:

    CREATE PROCEDURE vector_sample AS
    BEGIN
    
    DROP TABLE IF EXISTS dbo.Products;
    
    CREATE TABLE dbo.Products (
        Id int PRIMARY KEY,
        EmbeddingVector vector(1536)  -- Native vector type
    );
    
    DROP INDEX IF EXISTS IX_Products_EmbeddingVector ON dbo.Products;
    
    CREATE VECTOR INDEX IX_Products_EmbeddingVector 
    ON dbo.Products(EmbeddingVector)
    WITH (METRIC = 'COSINE');
    
    END;

...you will get the following error:

Query 1 ERROR at Line 1: : Msg: 2571, Line 13, State: 3, Level: 14
User 'dbo' does not have permission to run DBCC TRACEON.
Msg: 42234, Line 13, State: 1, Level: 16
DiskANN vector index build failed with an internal error 200.

Seems to be an issue creating vector indexes on Azure SQL via stored procedures.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits January 29, 2026 12:53
Co-authored-by: elbruno <3533489+elbruno@users.noreply.github.com>
Co-authored-by: elbruno <3533489+elbruno@users.noreply.github.com>
Co-authored-by: elbruno <3533489+elbruno@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix stored procedure and vector index permissions error Document Azure SQL Database limitation: vector indexes in stored procedures Jan 29, 2026
Copilot AI requested a review from elbruno January 29, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stored procedure & Vector Indexes

2 participants