mikedgibson
asked on
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?
>> 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
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
ASKER
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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..
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..
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.
Ignore that last comment. It was posted to the wrong thread.
MSSQL Import and Export utility will help you.
Reffer http://msdn.microsoft.com/en-us/library/ms140052.aspx for more details.