Maximum number of columns in a table

database, mysql, sql-server

Solution

SQL 2000 : 1024

SQL 2005 : 1024

SQL 2008 : 1024 for a non-wide table, 30k for a wide table.

The wide tables are for when you have used the new sparse column feature in SQL 2008 which is designed for when you have a large number of columns that are normally empty.

Just because these limits are available, does not mean you should be using them however, I would start with designing the tables based on the requirements and then check whether a vertical partitioning of 1 table into 2 smaller tables is required etc.

Problem

Problem1: What is the maximum no of columns we can have in a table Problem2: What is the maximum no of columns we should have in a table

Original source

Related problems