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
 Database Design and Application Architecture
 NULL on Empty Fields

Author  Topic 

bulubuk1976
Starting Member

24 Posts

Posted - 2008-03-16 : 20:04:48
How can I make empty cells show NULL on my table? Some cells show NULL others won't. Does this mean that they have contents?

The reason being is that, when I use the code

Select *
From Employees
Where JobDescription1 Like '%montly%'

Those with empty jobdescription1 show with the legitimate results.

Any help please?

Thanks!

jhocutt
Constraint Violating Yak Guru

385 Posts

Posted - 2008-03-16 : 20:39:11
Yes, The fileds that show NULL are actually set to NULL, the others are set to an empty string.
Try this
Where IsNull(JobDescription1, '') Like '%montly%'

"God does not play dice" -- Albert Einstein
"Not only does God play dice, but he sometimes throws them where they cannot be seen."
-- Stephen Hawking
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-03-17 : 04:50:05
select data from
(
select 'test' as data union all
select 'testing' union all
select '' union all
select null
) as t
where data like '%test%'


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -