Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Default Query Value

Author  Topic 

bulubuk1976
Starting Member

24 Posts

Posted - 2008-03-21 : 03:22:42
I am trying to query my records using a text field. However, I want my results to be all when there the text field is blank. Currently I have 257134 records but when I use my code, it is only showing 237423 records. Here is my code:

SELECT COUNT(ID) AS Count
FROM ViewAllEmployees
WHERE (JobDescription1 LIKE '%')

Any ideas as to what wildcard to use to show NULL and Not NULL records?

Thank so much

booyeeka
Starting Member

10 Posts

Posted - 2008-03-21 : 05:53:57
maybe you can find an answer on next link:

http://weblogs.asp.net/rmclaws/archive/2004/02/18/75381.aspx
Go to Top of Page

tosscrosby
Aged Yak Warrior

676 Posts

Posted - 2008-03-21 : 11:23:08
Depending on what you're trying to do.....

SELECT COUNT(ID) AS Count
FROM ViewAllEmployees
WHERE (JobDescription1 IS NOT NULL)

or

SELECT COUNT(ID) AS Count
FROM ViewAllEmployees
WHERE (JobDescription1 IS NULL)

or

SELECT COUNT(ID) AS Count
FROM ViewAllEmployees
WHERE (JobDescription1 = '') -- blank field


Terry
Go to Top of Page
   

- Advertisement -