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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 ISNull troubles

Author  Topic 

Trudye
Posting Yak Master

169 Posts

Posted - 2008-06-17 : 07:32:43
I'm having a problem creating a isnull statement.
I want to do two things I want to list all of the accounts that have a null value in a numeric field. And I want to update those accounts to 0.00.
I tried:
select Account_Num, isnull(TotalDDMFEE, 0)
FROM Addr_20080402
But it returned all records

For the update I tried:
update Addr_20080402
CASE
when TotalDDMFEE = ' ' then TotalDDMFEE = 0.00
AND
update Addr_20080402
CASE
when TotalDDMFEE = isnull(TotalDDMFEE, 0) then TotalDDMFEE = 0.00

Any ideas how I should have written these two queries?
Thanx,
Trudye

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2008-06-17 : 07:45:26
Just add:

where TotalDDMFEE is null to your query.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-17 : 07:46:08
[code]1.select Account_Num, TotalDDMFEE
FROM Addr_20080402
WHERE TotalDDMFEE IS NULL


2.update Addr_20080402
set TotalDDMFEE =0.00
WHERE TotalDDMFEE IS NULL
OR TotalDDMFEE =' '[/code]
Go to Top of Page

Trudye
Posting Yak Master

169 Posts

Posted - 2008-06-17 : 08:38:07
And the hits just keep on coming! It seems I tried to make that more complicated than it was.

Thanks much,
visakh16
Go to Top of Page
   

- Advertisement -