views:

74

answers:

1

I am creating this huge csv import, that uses the ms text driver, to read the csv file.

And I am using ColdFusion to create the scheme.ini in each folder's location, where the file has been uploaded.

Here is a sample one I am using:

[some_filename.csv]
Format=CSVDelimited
ColNameHeader=True
MaxScanRows=0
Col1=user_id Text width 80
Col2=first_name Text width 20
Col3=last_name Text width 30
Col4=rights Text width 10
Col5=assign_training Text width 1
CharacterSet=ANSI

Then in my ColdFusion code, I am doing 2 cfdump's:

<cfdump var="#GetMetaData( csvfile )#" />
<cfdump var="#csvfile#">

The meta data shows that the query has not grabbed the correct data types for reading the csv file.

And the dump of the query to read file, shows that it is missing values, because of Excel we can not force them to use double quotes. And when fields have mixed data types, then it causes our process to not work..

How can I either change the data type inside the query, aka make it use scheme.ini, or update metadata to the correct data type.

I am using a view on information_schema in sql server 2005 to get the correct data types, column names, and max lengths...

Unless I have some kind of syntax error, I can't see why it's not grabbing the data as the correct data type.

Any suggestions?

+1  A: 

Funnily, I had the filename spelled wrong, instead of using schema.ini i was having it as scheme.ini.

I hate when you make lil mistakes like this...

Thank You

crosenblum
Well you get bonus points for even using a schema.ini file in the first place! Few people do, which is a shame as it is easy to use and works perfectly :)
Leigh
Don't forget to come back and accept your answer after 48 hours.
Adam Tuttle
Thank you very much for help and support.
crosenblum