Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select statement looking for empty string not null string

Status
Not open for further replies.

sccenterprises

Programmer
Apr 4, 2005
6
US
I need to find out the correct sql statement to select only fields that are empty.

 
This:

Code:
SELECT cols
FROM table
WHERE col = ''

As opposed to this:

Code:
SELECT cols
FROM table
WHERE col IS NULL

--James
 
This is a SQL in VB 6.0 and I have tried

"Select * from Requistion where AppBy = ''"

and it just brings everything back even if AppBy has KHC in the field.
 
Try combining both statements if you also need to find the null values.

Code:
Select * from Requisition where AppBy = '' or AppBy = ' ' or AppBy is Null

Make sure to use single quotes, not double. This may be your problem. Also, I listed in my code two single quotes without a space and two single quotes *with* a space because sometimes, to a user, a space may look empty even when it's not.

Does that help?



Catadmin - MCDBA, MCSA
"Just because I'm paranoid doesn't mean the universe *isn't* out to get me!"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top