I have to say, I'd be suspicious of any database design that leads to a
requirement for counting the number of empty fields in a record. It sounds
like you haven't correctly normalised your data. If it's not too ate in the
day for your project, would you like to post some details of what's going
on, and we might be able to save you from typing out "AND /*-or OR-*/
(NullField2 IS NULL OR NullField2 = '')" one hundred times ;-)
Chris
-----Original Message-----
From: O15_11_2002 [mailto:[Email Address Removed]
Sent: Thursday, April 29, 2004 9:53 AM
To: LazyDBA.com Discussion
Subject: Re: Need help in query
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] 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