Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Importing flat file csv with variable column widths

$
0
0

Hi, 

I need to find a way to load csv files with variable column widths as right now, I'm tearing my hair out (and I don't have much left!)

Here's what happens: 

I run the SQL Server Import and Export Wizard; I point it to a csv file; I ask it to suggest column types, I go all the way to finish & then it complains that it can't load the file without truncating a field - but IT suggested the length of the field in the first place! 

So, I drop the table, go back to the beginning, fix the offending row, and try again. Sometimes I can go through this loop a dozen times trying to get the right sizes. 

Is there an option I'm missing - like read the WHOLE file before suggesting a size?  Or perhaps even an external program or script which could scan the data & tell me which sizes to set?

Less optimal would be some way to give me some whacking great size (like 5000) as the size of the field & then I can work out something better once I get the data into SQL.

I know I could turn off the error messages & just let the truncation happen... but I *need* the data in SQL. 

Any suggestions would be appreciated.

Thanks in advance, 

(Nearly Bald) Robert


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>