StoneDeCroze
Programmer
Hi Guys,
Anyone know whis of these will be faster:
@ASWN is a DECIMAL(18,6)
@ID is an INT
IF @ASWN > 0
UPDATE table SET field1=@ASWN WHERE ID=@ID
or
UPDATE table SET field1=@ASWN WHERE ID=@ID AND @ASWN > 0
Logically they are the same:
The first results in the execution of one or two statements, the second only ever one.
However, will the second example always look up ID in table, or if @ASWN <= 0 will it not bother (and is therefore probably quicker).
Thanks for any insights
Peter
Anyone know whis of these will be faster:
@ASWN is a DECIMAL(18,6)
@ID is an INT
IF @ASWN > 0
UPDATE table SET field1=@ASWN WHERE ID=@ID
or
UPDATE table SET field1=@ASWN WHERE ID=@ID AND @ASWN > 0
Logically they are the same:
The first results in the execution of one or two statements, the second only ever one.
However, will the second example always look up ID in table, or if @ASWN <= 0 will it not bother (and is therefore probably quicker).
Thanks for any insights
Peter