Stephen Forero
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.
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
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])
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
?
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
?
ASKER
looks that this will work... thanks!!! I'll try it out