0
中的数据类型时转换失败我收到错误“错误:将varchar值'10.8'转换为数据类型时出错”。错误:在将varchar值'10.8'转换为
我正在Azure数据仓库中写入此查询。 什么可能是错的,我没有做任何转换为Int。
select
cast(
case
when [total_amount] is null then 0
when [total_amount] = '' then 0
else [total_amount]
end
as decimal(10,4)
)
FROM [dbo].[ABC]
这个查询是一个外部表查询其也报告错误在查询执行计划步骤2,从外部表[NYCTaxiData]拒绝 6行:
Location: '/2016/yellow_tripdata_2016-07.csv' Column ordinal: 17, Expected data type: VARCHAR(50) collate SQL_Latin1_General_CP1_CI_AS, Offending value: VendorID,tpep_pickup_datetime,tpep_dropoff_datetime,passenger_count,trip_distance,RatecodeID,store_and_fwd_flag,PULocationID,DOLocationID,payment_type,fare_amount,extra,mta_tax,tip_amount,tolls_amount,improvement_surcharge,total_amount (Tokenization failed), Error: Not enough columns in this line.
Location: '/2016/yellow_tripdata_2016-10.csv' Column ordinal: 17, Expected data type: VARCHAR(50) collate SQL_Latin1_General_CP1_CI_AS, Offending value: VendorID,tpep_pickup_datetime,tpep_dropoff_datetime,passenger_count,trip_distance,RatecodeID,store_and_fwd_flag,PULocationID,DOLocationID,payment_type,fare_amount,extra,mta_tax,tip_amount,tolls_amount,improvement_surcharge,total_amount (Tokenization failed), Error: Not enough columns in this line.
Location: '/2016/yellow_tripdata_2016-11.csv' Column ordinal: 17, Expected data type: VARCHAR(50) collate SQL_Latin1_General_CP1_CI_AS, Offending value: VendorID,tpep_pickup_datetime,tpep_dropoff_datetime,passenger_count,trip_distance,RatecodeID,store_and_fwd_flag,PULocationID,DOLocationID,payment_type,fare_amount,extra,mta_tax,tip_amount,tolls_amount,improvement_surcharge,total_amount (Tokenization failed), Error: Not enough columns in this line.
Location: '/2016/yellow_tripdata_2016-09.csv' Column ordinal: 17, Expected data type: VARCHAR(50) collate SQL_Latin1_General_CP1_CI_AS, Offending value: VendorID,tpep_pickup_datetime,tpep_dropoff_datetime,passenger_count,trip_distance,RatecodeID,store_and_fwd_flag,PULocationID,DOLocationID,payment_type,fare_amount,extra,mta_tax,tip_amount,tolls_amount,improvement_surcharge,total_amount (Tokenization failed), Error: Not enough columns in this line.
Location: '/2016/yellow_tripdata_2016-08.csv' Column ordinal: 17, Expected data type: VARCHAR(50) collate SQL_Latin1_General_CP1_CI_AS, Offending value: VendorID,tpep_pickup_datetime,tpep_dropoff_datetime,passenger_count,trip_distance,RatecodeID,store_and_fwd_flag,PULocationID,DOLocationID,payment_type,fare_amount,extra,mta_tax,tip_amount,tolls_amount,improvement_surcharge,total_amount (Tokenization failed), Error: Not enough columns in this line.
Location: '/2016/yellow_tripdata_2016-12.csv' Column ordinal: 17, Expected data type: VARCHAR(50) collate SQL_Latin1_General_CP1_CI_AS, Offending value: VendorID,tpep_pickup_datetime,tpep_dropoff_datetime,passenger_count,trip_distance,RatecodeID,store_and_fwd_flag,PULocationID,DOLocationID,payment_type,fare_amount,extra,mta_tax,tip_amount,tolls_amount,improvement_surcharge,total_amount (Tokenization failed), Error: Not enough columns in this line.
什么** datatype **是你的'total_amount'列? –
它是varchar(50)NULL –