I have a data Excel 2010 file of statistics which I intend to import into a single table. The problem is that the file has 1500 columns. By default, SQL server import restricts the table created after import to 255 columns. Is there any way to extend this to include all 1500 columns?
Asked
Active
Viewed 991 times
0
-
SQL Server can't have more than 1024 columns per table unless you use sparse columns. – Dan Guzman Dec 02 '17 at 19:47
-
Ok, how could I import 2024 columns then? – J.Smith Dec 02 '17 at 21:33
2 Answers
0
You can use Wide tables by creating sparse columns. Columns per wide table size is 30000. You can look at this page; Maximum Capacity Specifications for SQL Server
You can create wide
table like this;
CREATE TABLE SampleWideTable(ID INT IDENTITY(1,1),
Column1 NVARCHAR(100) SPARSE,
Column2 NVARCHAR(100) SPARSE,
Column3 NVARCHAR(100) SPARSE)
But there are some advantages and disadvanteages for sparsed columns. You should read it first before taking action.

lucky
- 12,734
- 4
- 24
- 46
-
-
You can use DTF to perform it. There is a useful article here about importing data and creating table dynamically. https://stackoverflow.com/questions/28738805/dynamic-table-create-and-load-data-in-ssis – lucky Dec 02 '17 at 22:15
0
See this answer regarding importing 255 columns at a time using the range syntax:
myCommand = New OleDbDataAdapter("SELECT * FROM [" & _TableName & "AAO1:ABG3000]", conn)
myCommand.Fill(thisDS, _TableName)
Then programmatically append each of the datasets of columns back together.

gojimmypi
- 426
- 4
- 7