将时间戳值从 .txt 文件导入 Teradata 表中的等效列(UTC 时间戳) [英] Importing Timestamp Values from a .txt file into an equivalent column (UTC timestamp) in a Teradata Table

查看:15
本文介绍了将时间戳值从 .txt 文件导入 Teradata 表中的等效列(UTC 时间戳)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 .txt 文件的Ride_Time"列中有时间戳值.'Ride_Time' 列中的值的示例是 6/13/2016 9:39.我正在尝试通过导入 .txt 文件中Ride_Time"列中的值(使用导入数据"选项并将Ride_Time"列中的值插入到我的新 Teradata 表.下面是我的创建表查询,

I have Timestamp values in a column 'Ride_Time' in a .txt file. An example of a value in the 'Ride_Time' column is 6/13/2016 9:39. I am trying to create a table in Teradata using Teradata SQLA by importing the values in the 'Ride_Time' column in the .txt file (using the 'Import Data' option and inserting the values from the 'Ride_Time' column to an equivalent column in my new Teradata table. Below is my create table query,

CREATE TABLE Ride_Info
(
Ride_ID VARCHAR(50),
ride_time TIMESTAMP FORMAT 'YYYY-MM-DDbHH:MI:SS',

);

我不断收到无效时间戳"错误.有人可以帮我解决这个问题吗?

I keep getting the 'Invalid Timestamp' error. Can someone help me with this?

推荐答案

您输入的数据与目标列的格式不匹配(解决方案:应用/更改正确的格式)并且 Teradata 对个位数很挑剔(解决方案:正则表达式添加缺失的前导零).这应该有效

Your input data doesn't match the FORMAT of the target column (solution: apply/change the correct format) and Teradata is fussy regarding single digits (solution: RegEx to add missing leading zeroes). This should work

Cast(RegExp_Replace(?,'\b([0-9])\b', '0\1') AS TIMESTAMP(0) FORMAT 'mm/dd/yyyyBhh:mi')

这篇关于将时间戳值从 .txt 文件导入 Teradata 表中的等效列(UTC 时间戳)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆