SELECT SUM(TotalField1) AS SumOfTotalField1
FROM TABLE1
WHERE (NullField1 IS NULL or NullField1 = '')
AND /*-or OR-*/ (NullField2 IS NULL OR NullField2 = '')
AND /*-or OR-*/ (NullField3 IS NULL OR NullField3 = '')
If you use And operator query show only all null fields which are your
written where condition to result
if use Or operator query show whichever null fields to result
best regards
ali
----- Original Message -----
From: "Valsan, Jessy" <Jessy.[Email Address Removed] "LazyDBA.com Discussion" <[Email Address Removed] Thursday, April 29, 2004 11:21 AM
Subject: RE: Need help in query
> Hi,
>
> I have a table with 100 fields,Now few of these fields are emplty. I need
a
> query that will give me the total number of empty fields for a given
record.
>
> Pls help.
>
> Thanks
> Jessy
>
>
> This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an
intended recipient then please promptly delete this e-mail and any
attachment and all copies and inform the sender. Thank you.
>
> ---------------------------------------------------------------------
> TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
> Get today's cartoon: http://www.LazyDBA.com
> To unsubscribe, e-mail: mssqldba-[Email Address Removed] ,
> then respond to the confirmation email you get
> For additional commands, e-mail: mssqldba-[Email Address Removed]MS Sql Server LazyDBA home page