English 中文(简体)
如何构建 SSIS 表达式?
原标题:How to construct SSIS expression?

我要在 SQL BDS 和 衍生列中使用导出列,我想在以下栏中使用导出列:

(1) 如果源列含有 NULLL,则将其替换为“未知”

(2) 如果有数值,则用给定的字符串替换。

到目前为止,我一直想出这个, 但我对这些表达方式的语法不熟悉,

ISNULL(Source) ? "Unknown" :  REPLACE("m", "m", "Pop memories" ), REPLACE("h", "h", "Pop     hits" ), REPLACE("a", "a", "Pop annual" ), REPLACE("y", "y", "Yearbook" ), REPLACE("bs", "bs", "Bestsellers" ) 

我敢肯定问题在于每个替换器之间的逗号, 但我不知道还有什么用。有什么建议吗?

编辑:

好吧,我解决了。

ISNULL(Source) ? "Unknown" :  REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(Source, "bs", "Bestsellers" ), "m", "Pop memories" ), "h", "Pop     hits" ) , "a", "Pop annual" ), "y", "Yearbook" )
最佳回答

我建议不要使用这种静态表达方式。你的问题在于,如果你有其他案例,你必须找到和修改一个日益复杂的表达方式声明。

与源代码和描述相匹配的表格的查找转换将是一个更好的解决方案。 您可以设置该查找忽略空格, 然后在导出列转换中加入一个简单的表达式, 如以下 :

ISNULL(Description)?"Unknown":Description

这样,如果你有新的源代码, 你可以把它们添加到搜索表上, 不必更改任何代码 。

问题回答

暂无回答




相关问题
Export tables from SQL Server to be imported to Oracle 10g

I m trying to export some tables from SQL Server 2005 and then create those tables and populate them in Oracle. I have about 10 tables, varying from 4 columns up to 25. I m not using any constraints/...

SQL server: Can NT accounts be mapped to SQL server accounts

In our database we have an SQL server account that has the correct roles to access some of the databases. We are now switching to windows authentication and I was wondering if we can create a NT user ...

SQL Server 2000, ADO 2.8, VB6

How to determine if a Transaction is active i.e. before issuing Begin Transaction I want to ensure that no previous transaction are open.. the platform is VB6, MS-SQL Server 2000 and ADO 2.8

热门标签