当我尝试查看“报告此错误”消息时,
---------------------------
Crystal Report Viewer
---------------------------
Failed to open a rowset.
Details: ADO Error Code: 0x
Source: Microsoft OLE DB Provider for SQL Server
Description: Warning: Null value is eliminated by an aggregate or other SET operation.
SQL State: 01003
Native Error:
---------------------------
OK
---------------------------
注意:我将Direct连接到已排序的程序。
答案 0 :(得分:0)
检查内部程序如何使用聚合函数。
您可以使用
关闭此讯息SET ANSI_WARNINGS ON;
但我不建议这样做。
示例如何获得警告“聚合或其他SET操作消除了空值”
CREATE TABLE T1 (
a INT,
b INT NULL,
c VARCHAR(20)
);
GO
SET NOCOUNT ON
INSERT INTO T1
VALUES (1, NULL, '');
INSERT INTO T1
VALUES (1, 0, '');
INSERT INTO T1
VALUES (2, 1, '');
INSERT INTO T1
VALUES (2, 2, '');
SET NOCOUNT OFF;
GO
PRINT '**** Setting ANSI_WARNINGS ON';
GO
SET ANSI_WARNINGS ON;
GO
PRINT 'Testing NULL in aggregate';
GO
SELECT a, SUM(b)
FROM T1
GROUP BY a;
GO