How to increase the limit of columns per select statement in azure sql

Aiman Aslam 6 Reputation points
2022-08-26T18:48:39.653+00:00

Environment = Microsoft Azure SQL Database
I have dynamic query which has more than 4096 columns in select statement and I am getting this error while executing this.
The number of elements in the select list exceeds the maximum allowed number of 4096 elements.
I can't reduce the number of columns per select statement. Is there any way to increase the limit of columns per select statement in azure SQL database.?

235240-sql-error.png

Azure SQL Database
{count} vote

2 answers

Sort by: Most helpful
  1. GeethaThatipatri-MSFT 27,017 Reputation points Microsoft Employee
    2022-08-26T21:23:16.08+00:00

    Hi @Aiman Aslam Welcome to the Microsoft Q&A forum, and thanks for reaching out.
    Unfortunately that we don’t have a plan to increase the limit at this time.

    So, I suggest you review your data model and keep the number of points under the 4K limitation to avoid errors in future development.

    Please feel free to let me know if you have any concerns or further questions on this.

    Regards
    Geetha


  2. Erland Sommarskog 100.8K Reputation points MVP
    2022-08-26T21:34:55.98+00:00

    4096 columns in a SELECT statement? The mind boggles. Time for a redesign, I guess.

    Although, you could look at sparse tables and column sets. With sparse column, you can have up to 30000 columns per tables.

    0 comments No comments