We have a CSV file that is being imported with an
insert into #temptable select * from openrowset....
There is one field [Units] where the majority of the values are listed as integers. A few of them (1 out of 500) are decimal values (28.52). The decimal values are being reduced to integers (28). We have tried all sorts of tricks like predefining the temp table with the [units] field set as decimal(10,2) and by using Cast functions to get the values in as decimals. No joy in any of them.
We have noticed that the openrowset seems to get the data type from the first record in the file. If that record has decimal places then all of the records will have them. If it is an integer then again no joy.
Editing the file before import is not an option. How can openrowset be forced to return decimals?
Thank you.
Tim Roop
"If you can do something about it, why waste time getting upset? If you can't do anything about it, why bother getting upset on top of it? -Shantideva
insert into #temptable select * from openrowset....
There is one field [Units] where the majority of the values are listed as integers. A few of them (1 out of 500) are decimal values (28.52). The decimal values are being reduced to integers (28). We have tried all sorts of tricks like predefining the temp table with the [units] field set as decimal(10,2) and by using Cast functions to get the values in as decimals. No joy in any of them.
We have noticed that the openrowset seems to get the data type from the first record in the file. If that record has decimal places then all of the records will have them. If it is an integer then again no joy.
Editing the file before import is not an option. How can openrowset be forced to return decimals?
Thank you.
Tim Roop
"If you can do something about it, why waste time getting upset? If you can't do anything about it, why bother getting upset on top of it? -Shantideva