I use SQL Server to locally store data for statistical analysis. I create my tables from csv files that typically have hundreds of columns. Manually prescribing column names and types would be tedious, so I use “suggest types” in the Import Wizard to pick the correct type.
This works most of the time, but frequently my csv files have a “ragged top edge” (i.e., a lot of the columns are empty for the first thousand or million lines — a lot of these files are 1+ gb, thus the need for SQL Server to facilitate subsetting joining). Because the Import Wizard only looks at up to the first 1000 rows, this can fail my import. Is there a clever workaround?
The solution I can think of is to move the last thousand or so rows to the top of the file, just below the header row. But since some of these files are 1+ gb with millions of rows, I can’t do in a text editor. Is there a way that I can outsmart the Import Wizard? Or read backwards? Or move the last thousand or so lines?
Thanks!
It looks like you can’t set in the wizard but you can if you do it as a full SSIS solution.
And/or the row limit of 1000 is a bug in SQL Server 2008 (not sure about R2)
See this for more
I have set this sample rows myself at some point but can’t remember when and what version/SP level I used.