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 2000 Forums
 Transact-SQL (2000)
 Null is doing my head in!

Author  Topic 

hog
Constraint Violating Yak Guru

284 Posts

Posted - 2005-10-12 : 08:58:00
If I have 10 rows in @Resultset which all have the total_empty row set to zero then run this where only 9 of the rows are in @BinMaster then the 10th row gets set to NULL.

[code]
UPDATE A
SET A.total_empty = (SELECT COUNT(AA.occupied) FROM @BinMaster AA WHERE AA.occupied = 0 AND AA.group_code = A.group_code AND AA.size_group_code = A.size_group_code GROUP BY AA.group_code, AA.size_group_code)
FROM @ResultSet A
[code/]

But is I try to update @ResultSet as follows

[code]
UPDATE A
SET A.total_empty = 0
FROM @ResultSet A
WHERE A.total_empty = NULL
[code/]

No update takes place?

Even more wierd if I try to query @ResultSet for NULL in total_empty I get no results? If I get output all of @ResultSet it displays the 10th row with NULL in the total_empty column?

What have I missed here?

Thanks in hope.....

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-12 : 09:03:02
Use A.total_empty Is NULL


Madhivanan

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

hog
Constraint Violating Yak Guru

284 Posts

Posted - 2005-10-12 : 09:06:21
Yoinks!!!

I shall leave this place henceforth and beat myself about the head with a large iceberg lettuce for my foolish schoolboy error!

Thnx :)
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-12 : 09:12:38
quote:
Originally posted by hog

Yoinks!!!

I shall leave this place henceforth and beat myself about the head with a large iceberg lettuce for my foolish schoolboy error!

Thnx :)


No need
Just learn from Error

Madhivanan

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

hog
Constraint Violating Yak Guru

284 Posts

Posted - 2005-10-12 : 09:22:15
lol :)
Go to Top of Page
   

- Advertisement -