How do determine data types from .csv file columns?

I am looking to import columns from a .csv file to a MS SQL database. Is there a utility out there that can analyze a .csv file to make recommendations on what the best data type is based on the data in the column?
LVL 2
mikedgibsonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pschakravarthiCommented:
Hi,

MSSQL Import and Export utility will help you.
Reffer http://msdn.microsoft.com/en-us/library/ms140052.aspx for more details.

0
Raja Jegan RSQL Server DBA & Architect, EE Solution GuideCommented:
>> Is there a utility out there that can analyze a .csv file to make recommendations on what the best data type is based on the data in the column?

No, You have to tell SQL Server the datatypes of the columns in the csv file

* Import & Export Wizard - Need to specify datatype for correct conversion
* BCP - Need to create Format File specifying datatype
* SSIS Package - Need to map with appropriate Datatype
0
mikedgibsonAuthor Commented:
Is there at least a utility that will look at the file and tell you the max length of each field so I can set the string sizes appropriately?
0
Powerful Yet Easy-to-Use Network Monitoring

Identify excessive bandwidth utilization or unexpected application traffic with SolarWinds Bandwidth Analyzer Pack.

Raja Jegan RSQL Server DBA & Architect, EE Solution GuideCommented:
Since it is a CSV file, just dump it into a temp table with all columns having datatype as varchar(1000)..
You can identify the max length of each and every column present in the feed file and then set that as the length of your columns..
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Raja Jegan RSQL Server DBA & Architect, EE Solution GuideCommented:
angelIII,

Since CSV file wont contain information about the datatype of columns along with max length of the columns, I have requested above to load it into a table with all varchar columns and after that manually analyze the data type and length of those fields..
Hence I would recommend

Accept 29060683

Using Import and Export Wizard will not help as we need to specify the datatypes and column length manually..
0
_agx_Commented:
Unfortunately, that won't work with the ODBC datasource because the conversions occur automatically _before_ the process even makes it to load into varchar column step.  ie When the insert occurs, the data is already corrupted. That's why the schema.ini file is needed.
0
_agx_Commented:
Ignore that last comment. It was posted to the wrong thread.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.