Link to home
Start Free TrialLog in
Avatar of Stephen Forero
Stephen ForeroFlag for United States of America

asked on

sql, if then else in stored procedure

Hi All,

I'm trying to do the below and not so great at sql.  Can anyone help me with the following statement?

.  This will be in a stored procedure
same concept as if then else...  but i dont think it can be a case

This is my original.

UPDATE dbo.DailyPositions_JEFF
SET [P&L Settlement]= (((ISNULL([Delta Settlement],0)*[Value 1Point])*[Local Rate])*[Qty_Net])

Open in new window


I want to say...
If [Value 1Point] = 0.9999
Then
do this
SET [p&L Settlement] =
[delta settlement] *
(1/[tick_size]) *[tick_value]
*
[local rate]

else.... do this

SET [P&L Settlement]= (((ISNULL([Delta Settlement],0)*[Value 1Point])*[Local Rate])*[Qty_Net])



thanks for all the help
ASKER CERTIFIED SOLUTION
Avatar of Ephraim Wangoya
Ephraim Wangoya
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Stephen Forero

ASKER

ahha.... I didnt know that... kinda looks like a iF ELSE anyway.
looks that this will work... thanks!!!  I'll try it out
worked... thank you!!!

another question in terms of performance and speed.

which is faster..
1.   to use the case ... else
or
2.  have the stored procedure call a scalar function
scalar function using pulled in paramaters will a true if else
?