I'm using sql syntax like the following:
This works well.
Except for the case that I sometimes have numeric entries in the '.csv' file that have thousand separators so perhaps I have lines like:
(Suppose the first line is the field/column names in this instance)
CustomerCode,CustomerName,Balance
CUST1,Customer 1,250
CUST2,Customer 2,"1,000"
CUST3,Customer 3,400
When I run the above SQL syntax I get the result set
CUST1 | Customer 1 | 250
CUST2 | Customer 2 | NULL
CUST3 | Customer 3 | 400
So the value with the thousand separator in it ("1,000") is being interpreted as a NULL in my result set.
Can anyone suggest how I can get the required value of 1000?
Is there some property I can set that will enable me to do this?
Thanks in advance.
Steve
Code:
select *
from OpenRowset('MSDASQL',
'Driver={Microsoft Text Driver (*.txt; *.csv)};
DefaultDir=C:\MyDirectory\',
'select top 1 * from MyFile.csv')
This works well.
Except for the case that I sometimes have numeric entries in the '.csv' file that have thousand separators so perhaps I have lines like:
(Suppose the first line is the field/column names in this instance)
CustomerCode,CustomerName,Balance
CUST1,Customer 1,250
CUST2,Customer 2,"1,000"
CUST3,Customer 3,400
When I run the above SQL syntax I get the result set
CUST1 | Customer 1 | 250
CUST2 | Customer 2 | NULL
CUST3 | Customer 3 | 400
So the value with the thousand separator in it ("1,000") is being interpreted as a NULL in my result set.
Can anyone suggest how I can get the required value of 1000?
Is there some property I can set that will enable me to do this?
Thanks in advance.
Steve