I have a csv file that has the first 7 columns as varchar (string), while the rest of them are 'Real' data type. I believe the .NET equivalent of Real is Single.
Anyways, i tried the following based on a suggestion:
,(Import-Csv -Path ".\Fact.csv") | Write-SqlTableData -ServerInstance "server.db.com" -DatabaseName
"TestDB" -SchemaName "dbo" -TableName "Fact" -Force
and i received this (expected) error:
Write-SqlTableData : The given value of type String from the data source cannot be converted to type real of the specified target column.
The question is: How to make this utility accept Real datatypes?
csv file sample:
BGSC,MYTrim Code,CC,OC,Ctry Of Prod,Report Year,Scenario,Volume,Gross Revenue ,SA ,ANSR, TM ,TL,"P and Warranty, others",CM ,Total Variable,Variable Profit , EBIT
TOTAL_CKD,TOTAL_MODEL_YEAR_AND_GLOBAL_TRIM,COS_AU,4F80, ,2015,Current, - , - , - , - , - , - , - , - , - , - ," (136,748)"
CXXXXXXXXXX,TOTAL_MODEL_YEAR_AND_GLOBAL_TRIM,COS_AU,4F80, ,2013,Current, - , - , - , - , - , - , - , - , - , - ," 1,647 "
CXXXXXXXXXX,TOTAL_MODEL_YEAR_AND_GLOBAL_TRIM,COS_AU,4F80, ,2014,Current, - ," 16,098 ", (0)," 16,098 ", 1 , - , 8 ," 16,090 ", - ," 16,090 "," 61,219 "
CXXXXXXXXXX,TOTAL_MODEL_YEAR_AND_GLOBAL_TRIM,COS_AU,4F80, ,2015,Current, - ," (12,496)", - ," (12,496)"," (13,386)", - , - , 890 , - , 890 , (192)