From: Rick on
select Field1, Field2, Field3, Field4, Field5, Field6 from Mytable
I need to retrieve records if any of the listed filed value is empty/null.
From: Plamen Ratchev on
Try (assuming empty means blank string):

SELECT col1, col2, col3
FROM Foo
WHERE col1 IS NULL OR col1 = ''
OR col2 IS NULL OR col2 = ''
OR col3 IS NULL OR col3 = '';


--
Plamen Ratchev
http://www.SQLStudio.com
From: Jay Konigsberg on
SELECT Field1, Field2, Field3, Field4, Field5, Field6
FROM Mytable
WHERE ISNULL(Field1, '') = ''
OR ISNULL(Field1, '') = ''
OR ISNULL(Field1, '') = ''
OR ISNULL(Field1, '') = ''
OR ISNULL(Field1, '') = ''
OR ISNULL(Field6, '') = ''

--
Jay Konigsberg
SQL Server DBA in Sacramento, CA (looking for work)
http://www.linkedin.com/in/jaykonigsberg

Live in Sacramento, CA?
Join the Sacramento SQL Server User Group on LinkedIn
http://www.linkedin.com/groups?home=&gid=2825448&trk=anet_ug_hm&goback=%2Emyg



"Rick" <Rick(a)discussions.microsoft.com> wrote in message
news:09C7E012-0A5A-42AE-9D22-591061E1A813(a)microsoft.com...
> select Field1, Field2, Field3, Field4, Field5, Field6 from Mytable
> I need to retrieve records if any of the listed filed value is empty/null.


From: Jay Konigsberg on
SELECT Field1, Field2, Field3, Field4, Field5, Field6
FROM Mytable
WHERE ISNULL(Field1, '') = ''
OR ISNULL(Field2, '') = ''
OR ISNULL(Field3, '') = ''
OR ISNULL(Field4, '') = ''
OR ISNULL(Field5, '') = ''
OR ISNULL(Field6, '') = ''

hit send too fast.
>
> --
> Jay Konigsberg
> SQL Server DBA in Sacramento, CA (looking for work)
> http://www.linkedin.com/in/jaykonigsberg
>
> Live in Sacramento, CA?
> Join the Sacramento SQL Server User Group on LinkedIn
> http://www.linkedin.com/groups?home=&gid=2825448&trk=anet_ug_hm&goback=%2Emyg
>
>
>
> "Rick" <Rick(a)discussions.microsoft.com> wrote in message
> news:09C7E012-0A5A-42AE-9D22-591061E1A813(a)microsoft.com...
>> select Field1, Field2, Field3, Field4, Field5, Field6 from Mytable
>> I need to retrieve records if any of the listed filed value is
>> empty/null.
>
>


From: Rick on
thanks

"Plamen Ratchev" wrote:

> Try (assuming empty means blank string):
>
> SELECT col1, col2, col3
> FROM Foo
> WHERE col1 IS NULL OR col1 = ''
> OR col2 IS NULL OR col2 = ''
> OR col3 IS NULL OR col3 = '';
>
>
> --
> Plamen Ratchev
> http://www.SQLStudio.com
> .
>
 | 
Pages: 1
Prev: Export table with Cursor
Next: sql server displays