December 23, 2005 at 12:29 pm
Let's say I have the following value clause in an insert statement:
"Column1" = (SELECT CASE WHEN SUM(ABS(t.Amount)*c.CalcInvestedAmount) IS NULL THEN 0 ELSE SUM(ABS(t.Amount)*c.CalcInvestedAmount) END
Let's say the value IS NOT NULL, will the expression be executed twice?? i.e. the sum(ABS(t.amount)*c......)
?????
December 23, 2005 at 2:04 pm
the case returns one of two values, 0 or the calculation.
you could replace it with the same functionality:
column1=isnull(SUM(ABS(t.Amount)*c.CalcInvestedAmount) ,0)
a little less verbose, but with the same results.
Lowell
December 23, 2005 at 4:31 pm
Great. The stored procedure I am working on has about 40 of these throughout. I am hoping to chop some time off of it.
Thanks for the response.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply