How to Fix the SQL/Server 1024 Column Limit
For normal tables, SQL/Server has a hard limit of 1024 columns. This article explains what to do if your Salesforce table has more than 1024 columns.
Overall Solution
SQL/Server will support up to 30,000 columns per table but to achieve this columns above the 1024 limit must be created as SPARSE columns. A sparse column is a column whose value is stored in a special column that contains an XML document. Naturally, sparse columns are more expensive to search and update than regular columns but they do provide a way to get past the 1024 limit.
The produced to fix a problem table is:
- Turn a table into a wide table by adding a new column to hold sparse column values.
- Identify which columns to change to sparse columns.
- ALTER the definition of the identified columns to be sparse.
Example
The following example code creates a regular table and then turns it into a wide table and changes most of its columns to be sparse.
For Additional Help
Google SQL Server Wide Table and you will find many helpful articles.