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)
 Inconsistent count(1) from <> and !=

Author  Topic 

mamojama
Starting Member

1 Post

Posted - 2006-05-04 : 12:08:35
Hello All --

Running the exact same count query multiple times returns inconsistent results. There are no other operations running on the table. A copy of the table exhibits same behaviour of inconsistent results. SQL Server 2K. NOT LIKE appears to return consistent results. Anyone have an idea what is going on here? Thanks all.

Example 1:

select COUNT(1) from customer_0_a DIM
where
DIM.zip_fail_level = '1'
AND (DIM.lne_1_adr != 'U')
AND (DIM.city_nme = 'U')
AND (DIM.st_cde != 'U')
AND (DIM.zip_cde != 'U')
-- RESULTS
-- RUN 1: 2204657
-- RUN 2: 1945483

Example 2:

select count(1) from customer_0_a
where zip_fail_level = '1'
and latest_flag = '1'
and lne_1_adr <> 'U'
and city_nme <> 'U'
and st_cde <> 'U'
and postal_cde <> 'U'
-- TIMESTAMP RESULT
-- 12:40:03.32 2096751
-- 12:40:38.10 88647
-- 12:41:04.28 2201227
-- 12:41:38.45 84236
-- 12:42:37.34 1827736
-- 12:44:20.64 88532
-- 12:44:43.00 88647
-- 12:45:19.29 2268283
-- 13:18:08.65 1777721
-- 13:18:53.25 1458529
   

- Advertisement -