我正在使用 Excel 作为我的数据源的报表生成器。我很难在查询设计器中创建查询文本。当我尝试简单组语句的条件语句时出现错误。
我有这样的声明:
SELECT [Flight No],[Full Name],[Date],[Selected Routing 1] AS Routing,
[Selected ETD 1] AS ETD,[Selected ETA 1] AS ETA
FROM [Sheet1$]
这将返回这些值:
Flight No Full Name Date Routing ETD ETA
1 Peter Hansen 10/1/2012 BNE-MEL 1755 2020
2 Black Hansen 10/2/2012 BNE-MEL 1756 2021+1
现在,我想创建一个条件语句,即当 ETA 的编号为 +1 时,日期将加 1。因此表格应如下所示:
Flight No Full Name Date Routing ETD ETA
1 Peter Hansen 10/1/2012 BNE-MEL 1755 2020
2 Black Hansen 10/3/2012 BNE-MEL 1756 2021+1
当我尝试在报表生成器中使用这样的 SQL 语句时,我似乎得到了一个错误:
SELECT [Flight No],[Full Name],If([Selected ETA 1] LIKE '*+*',[Date]+1,[Date])
AS DATE, [Selected Routing 1] AS Routing,[Selected ETD 1] AS ETD,
[Selected ETA 1] AS ETA
FROM [Sheet1$]
错误说:
An error occurred while executing the query.
ERROR [42000撛] [Microsoft][ODBC Excel Driver] Undefined function 'if' in expression.
(Microsoft SQL Server Report Builder)
ERROR [42000撛] [Microsoft][ODBC Excel Driver] Undefined function 'if' in expression.
(ACEODBC.DLL)
如果可能,请给我参考。谢谢!