Calculate Iron Condor MAX Gain in SQL Server

This is one of many functions used on MTR Investors Group to calculate option return values.
Create FUNCTION [dbo].[f_get_condor_gain_pct] 
 @SellStrike decimal(18,2),
 @BuyStrike decimal(18,2), 
 @PutSellPrice decimal(18,2),
 @PutBuyPrice decimal(18,2),
 @CallSellPrice decimal(18,2),
 @CallBuyPrice decimal(18,2)
RETURNS decimal(18,2)
declare @GainAmount decimal(18,2);
declare @SpreadAmount decimal(18,2);

--The Option Sell > Buy - On Strikes the call side is flipped.
set @GainAmount = ((@PutSellPrice - @PutBuyPrice) + (@CallSellPrice - @CallBuyPrice)) * 100 ;
set @SpreadAmount = (@SellStrike - @BuyStrike) * 100;
if (@GainAmount = 0 or @SpreadAmount = 0) return 0;

return (@GainAmount / @SpreadAmount);


Create Temp Table from a Select Statement in SQL Server

Performing a select into in order to create a table from another table is SQL Server is very straight forward.
select * from MyTable 
If you want to create a table dynamically from a select statement  where you are joining multiple tables just add a table alias in the second select statement.  
(select a.field1, a.field2, a.field3, b.fieldx
 from MyTableA a, MyTableB B
 where a.field1 = b.field1 
 ) TableX -- An Alias is required to perform a SELECT INTO