SQLTeam.com | Weblogs | Forums

Need a better way to check for blanks/nulls

I have this working but is not so elegant. this is in crystal reports syntax but the concept is the same in sql. I need to query based on a passed parameter. The user enters one field. WHich can be either the UPC or Item code. (they would be scanning boxes in a warehouse). Everything is easy except that the UPC has many rows that the upc is blank, the item is always there. So if they enter a blank it shows alot of data rows we dont' want. the below works but the boss feels it should be in a null form. both upc and item are character string fields.

HasValue({?Item_or_UPC}) and
(
{VCOM_PROD_SKU_LOC.ITMREF_0} = {?Item_or_UPC} or
{VCOM_PROD_SKU_LOC.UPC} = {?Item_or_UPC} and ({VCOM_PROD_SKU_LOC.UPC} <> ' ')
)