我正在尝试从 tbl1 中读取类型为 varchar(255) 的列,并将其作为 datetime 类型加载到 tbl2。请参阅下面的代码。
SELECT CAST(LTRIM(RTRIM(NLCompany)) AS varchar(20)) AS SRC_NLCompany,
CAST(LTRIM(RTRIM(AccountCode)) AS varchar(8)) AS SRC_AccountCode,
CAST(LTRIM(RTRIM(DocumentNumber)) AS numeric(10, 0)) AS SRC_DocumentNumber,
CAST(LTRIM(RTRIM(PaymentType)) AS varchar(1)) AS SRC_PaymentType,
CAST(LTRIM(RTRIM(PostingDaybkDate)) AS datetime) AS SRC_PostingDaybkDate
FROM TBL1
错误:将 varchar 数据类型转换为 datetime 数据类型导致值超出范围。