我有使用 BCP 从 SQL Server 提取的数据,该文件是 ASCII CSV。
日期采用 2016-03-03T23:00:00 格式。
运行提取时我得到
附加信息:
{"diagnosticCode":195887127,"severity":"Error","component":"RUNTIME","source":"User","errorId":"E_RUNTIME_USER_EXTRACT_COLUMN_CONVERSION_INVALID_ERROR","message":"尝试转换时出现无效字符列数据。","description":"HEX: \"223022\" 转换输入记录时出现无效字符。\n位置:第 1 行,第 21 列。","resolution":"检查输入是否有错误或使用 \"silent \" 切换到忽略输入中过大(过小)大小的行。\n考虑忽略 \"invalid\" 行可能会影响作业结果,并且类型必须可以为空才能忽略转换错误。","helpLink": ““,“细节”:”==================================================== ==========================================\nHEX:5432333B35313B34362D323031362E30332E30335432333B30303B30302D302D352D323031362E30332E30335432333B35313B34392F3536372D302D323031362E30332E3033\n ^\ nTEXT:T23:51:46,2016-03-03T23:00:00,0,5,2016-03-03T23:51:49.567,0,2016-03-03\n
您如何在提取时正确处理日期?我不清楚为什么它会在日期时间列的中间分裂。
示例行看起来像
50CA2FBB-95C3-4216-A729-999BE2DB491A,2016-03-03T23:51:49.567,1001464881,1001464795,1001464795,00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000000,100 ,100 , ,12643,bCAwvRnNVwrKDXKxZkVed2Z1zHY=,o2lsnhueDApmvSbm31mh3aetYnc=,2016-03-03T23:50:46,2016-03-03T23:00:00,2016-03-03T23:51:46,20016-03,-0002: ,5,2016-03-03T23:51:49.567,0,2016-03-03T00:00:00,2016-03-03T23:59:59,00000000-0000-0000-0000-000000000000
Extract Statement is
@res =
EXTRACT
LicenseId Guid,
EntryDate DateTime,
UltimateId long,
SiteId string,
VirtualId string,
ProjectId Guid,
DocumentId Guid,
MasterId string,
ProductId string,
FeatureString string,
VersionId long,
ComputerSid string,
UserSid string,
AppStartTime DateTime,
StartHour DateTime,
AppStopTime DateTime,
StopHour DateTime,
GmtDelta int,
RecordedGmtDelta int,
LastUpdated DateTime,
Processed bool,
StartDate DateTime,
EndDate DateTime,
ImsId Guid
FROM @dataFile
USING Extractors.Csv();