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)
 strange update problem

Author  Topic 

00kevin
Yak Posting Veteran

78 Posts

Posted - 2010-05-25 : 09:19:48
Hi,

I have a table (table1) with several columns that are updated constantly from a .net application. Sometimes several updates occur per second.

I also have a procedure that uses the values in Table1 to perform some calculations and it insert the results into Table2

The problem is that the results of the calculations are sometimes 0 when they shouldn't be. Each time I run the procedure to perform the calculations different columns in table2 end up having zeros. the zeros are the results of nullif(x,0) in the equation.

I'm not sure if this is some kind of timing issue or locking problem.

There are transactions around every update to the first table and every update to the second table.

How do I solve this issue?

Sachin.Nand

2937 Posts

Posted - 2010-05-25 : 09:36:12
I doubt the zeroes are because of nullif(x,0).Because if x is 0 then function nullif will return NULL and if x is not zero then it will return the value of x.


PBUH
Go to Top of Page

00kevin
Yak Posting Veteran

78 Posts

Posted - 2010-05-25 : 09:38:45
yes you are correct... I got my functions confused. the calculation is using isnull(x,0)
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2010-05-25 : 10:16:23
Have a look here.

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=144796

PBUH
Go to Top of Page
   

- Advertisement -