SSIS:转换 SOQL 查询中的数据类型以进行 SSMS 验证 table
SSIS: Convert datatypes in a SOQL query for a SSMS validation table
我正在开发一个使用 SSIS 引入 SalesForce tables 的 EDW。我正在对 CData Salesforce 源编写一个验证查询,该查询将 return CURRENT_DATEIME() 加载时以及列值的总和,以便稍后使用我的验证策略。我将这些列的结果导入 SSMS 中的源验证 table。我遇到的问题 运行 是 CData 将列默认为 STRING 数据类型,而我在两者上都需要 NUMERIC,但显然您不能在 SOQL 查询中进行解析、转换或转换。转换它们的最佳方法是什么?
这是我到目前为止的查询......
SELECT TABLE_NAME, SOURCE_COLUMN_VALUE, COLUMN_NUMBER, LOAD_DATE, LOAD_DATETIME
FROM (
SELECT 'TABLE' AS TABLE_NAME, COUNT(*) AS SOURCE_COLUMN_VALUE, 0 AS
COLUMN_NUMBER, CURRENT_DATE() AS LOAD_DATE, CURRENT_TIMESTAMP() AS
LOAD_DATETIME
FROM [TABLE] UNION ALL
SELECT 'TABLE' AS TABLE_NAME, SUM(CASE WHEN Id IS NULL THEN 0 ELSE 1
END) AS SOURCE_COLUMN_VALUE, 1 AS COLUMN_NUMBER, CURRENT_DATE() AS
LOAD_DATE,CURRENT_TIMESTAMP() AS LOAD_DATETIME FROM [TABLE]
)
我需要使用 SOQL 将选定的列 SOURCE_COLUMN_VALUE 和 LOAD_DATETIME 转换为 NUMERIC。
我已经尝试了 TO_NUMBER() 和 NUMERIC.PARSE()
这是我不断收到的错误
Error: 0xC020901C at BASS_USER_VALIDATION, OLE DB Destination [29]: There was an error with OLE DB Destination.Inputs[OLE DB Destination Input].Columns[LOAD_DATE] on OLE DB Destination.Inputs[OLE DB Destination Input]. The column status returned was: "The value could not be converted because of a potential loss of data.".
Error: 0xC0209029 at BASS_USER_VALIDATION, OLE DB Destination [29]: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "OLE DB Destination.Inputs[OLE DB Destination Input]" failed because error code 0xC0209077 occurred, and the error row disposition on "OLE DB Destination.Inputs[OLE DB Destination Input]" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
Error: 0xC0047022 at BASS_USER_VALIDATION, SSIS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "OLE DB Destination" (29) failed with error code 0xC0209029 while processing input "OLE DB Destination Input" (42). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.
我们最终使用派生列解决了这个问题,在派生列中我们能够获取日期时间的字符串,将其解析为所需的内容,并将其转换为数字类型。我敢肯定这不是最有效的,但它正在做需要做的事情! (SalesForce 表会让我死)
(DT_NUMERIC,12,4)(DT_DATE)(SUBSTRING(LOAD_DATETIME,1,4) + "-" + SUBSTRING(LOAD_DATETIME,FINDSTRING(LOAD_DATETIME,"-",1) + 1,2) + "-" + SUBSTRING(LOAD_DATETIME,FINDSTRING(LOAD_DATETIME,"-",2) + 1,2) + " " + SUBSTRING(LOAD_DATETIME,FINDSTRING(LOAD_DATETIME,"T",1) + 1,2) + ":" + SUBSTRING(LOAD_DATETIME,FINDSTRING(LOAD_DATETIME,":",1) + 1,2))
我正在开发一个使用 SSIS 引入 SalesForce tables 的 EDW。我正在对 CData Salesforce 源编写一个验证查询,该查询将 return CURRENT_DATEIME() 加载时以及列值的总和,以便稍后使用我的验证策略。我将这些列的结果导入 SSMS 中的源验证 table。我遇到的问题 运行 是 CData 将列默认为 STRING 数据类型,而我在两者上都需要 NUMERIC,但显然您不能在 SOQL 查询中进行解析、转换或转换。转换它们的最佳方法是什么?
这是我到目前为止的查询......
SELECT TABLE_NAME, SOURCE_COLUMN_VALUE, COLUMN_NUMBER, LOAD_DATE, LOAD_DATETIME
FROM (
SELECT 'TABLE' AS TABLE_NAME, COUNT(*) AS SOURCE_COLUMN_VALUE, 0 AS
COLUMN_NUMBER, CURRENT_DATE() AS LOAD_DATE, CURRENT_TIMESTAMP() AS
LOAD_DATETIME
FROM [TABLE] UNION ALL
SELECT 'TABLE' AS TABLE_NAME, SUM(CASE WHEN Id IS NULL THEN 0 ELSE 1
END) AS SOURCE_COLUMN_VALUE, 1 AS COLUMN_NUMBER, CURRENT_DATE() AS
LOAD_DATE,CURRENT_TIMESTAMP() AS LOAD_DATETIME FROM [TABLE]
)
我需要使用 SOQL 将选定的列 SOURCE_COLUMN_VALUE 和 LOAD_DATETIME 转换为 NUMERIC。
我已经尝试了 TO_NUMBER() 和 NUMERIC.PARSE()
这是我不断收到的错误
Error: 0xC020901C at BASS_USER_VALIDATION, OLE DB Destination [29]: There was an error with OLE DB Destination.Inputs[OLE DB Destination Input].Columns[LOAD_DATE] on OLE DB Destination.Inputs[OLE DB Destination Input]. The column status returned was: "The value could not be converted because of a potential loss of data.".
Error: 0xC0209029 at BASS_USER_VALIDATION, OLE DB Destination [29]: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "OLE DB Destination.Inputs[OLE DB Destination Input]" failed because error code 0xC0209077 occurred, and the error row disposition on "OLE DB Destination.Inputs[OLE DB Destination Input]" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
Error: 0xC0047022 at BASS_USER_VALIDATION, SSIS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "OLE DB Destination" (29) failed with error code 0xC0209029 while processing input "OLE DB Destination Input" (42). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.
我们最终使用派生列解决了这个问题,在派生列中我们能够获取日期时间的字符串,将其解析为所需的内容,并将其转换为数字类型。我敢肯定这不是最有效的,但它正在做需要做的事情! (SalesForce 表会让我死)
(DT_NUMERIC,12,4)(DT_DATE)(SUBSTRING(LOAD_DATETIME,1,4) + "-" + SUBSTRING(LOAD_DATETIME,FINDSTRING(LOAD_DATETIME,"-",1) + 1,2) + "-" + SUBSTRING(LOAD_DATETIME,FINDSTRING(LOAD_DATETIME,"-",2) + 1,2) + " " + SUBSTRING(LOAD_DATETIME,FINDSTRING(LOAD_DATETIME,"T",1) + 1,2) + ":" + SUBSTRING(LOAD_DATETIME,FINDSTRING(LOAD_DATETIME,":",1) + 1,2))