0

如何在 SSIS 包中的 SQL 代码下方进行转换,因为我试图在 Extra Derived Column 中使用相同的 SQL 代码,但在这里我遇到了错误。

SQL 代码:

REVERSE(SUBSTRING(REVERSE ([MeasureName]),PATINDEX('% %',REVERSE ([MeasureName])),50))

Please suggest me

Error Msg:

------------------------------

Error at  DRIVE [Extra Derived Columns [1567]]: Parsing the expression "REVERSE(SUBSTRING(REVERSE ([MeasureName]),PATINDEX('% %',REVERSE ([MeasureName])),50))" failed. The single quotation mark at line number "1", character number "52", was not expected.

Error at  DRIVE [Extra Derived Columns [1567]]: Cannot parse the expression "REVERSE(SUBSTRING(REVERSE ([MeasureName]),PATINDEX('% %',REVERSE ([MeasureName])),50))". The expression was not valid, or there is an out-of-memory error.

Error at  DRIVE [Extra Derived Columns [1567]]: The expression "REVERSE(SUBSTRING(REVERSE ([MeasureName]),PATINDEX('% %',REVERSE ([MeasureName])),50))" on "output column "Derived Column 1" (2025)" is not valid.

Error at  DRIVE [Extra Derived Columns [1567]]: Failed to set property "Expression" on "output column "Derived Column 1" (2025)".

------------------------------
ADDITIONAL INFORMATION:

Exception from HRESULT: 0xC0204006 (Microsoft.SqlServer.DTSPipelineWrap)

谢谢

4

1 回答 1

0

好的,在 SSIS 中没有PATINDEX你需要使用FINDSTRING `:

FINDSTRING(character_expression, searchstring, occurrence)

返回字符串在字符表达式中指定出现的位置

这不会抛出错误,但可能不是你想要的,因为我不知道你试图用你的字符串实现什么:

REVERSE(SUBSTRING(REVERSE([Company]),FINDSTRING("% %",REVERSE([Company]),1),50))
于 2013-09-22T13:30:53.837 回答