-- Create this view to simulate the issue
CREATE VIEW VW_DUMMY
AS
SELECT * FROM (
SELECT SUM(CAST(NULL AS INT)) AS SOME_FILED )AS X WHERE SOME_FILED IS NOT NULL
go
-- and bcp using below command-line
bcp mydbname..vw_dummy out dummy.txt -Smyservername -T -c
SET ANSI_WARNINGS ON
select * from vw_dummy -- switch to messages tab, shows a warnig message
SET ANSI_WARNINGS OFF
select * from vw_dummy -- now it wont
ASKER
ASKER
Microsoft SQL Server 2005 is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning. It includes support for managing XML data and allows a database server to be exposed over web services using Tabular Data Stream (TDS) packets encapsulated within SOAP (protocol) requests.
TRUSTED BY
since the only aggreagate function you use is SUM, i think the simplest solution will be to change you query to
SELECT * FROM (
SELECT SUM(ISNULL(your_column,0))
go
since adding 0 to the sum does not change the result