How to execute below procedure for insert update
create procedure InsertData
as begin
declare @Result as int,@segment varchar(3), @tradeID bigint = null,@accountID varchar(20),
@symbol1 varchar(20),@tradedqty bigint,@tradeprice money,
@transtype int,@tradetime varchar(20),@traderID bigint,
@locationID varchar(25),@orderentrytime varchar(20),
@process1 int,@isin varchar(20)
exec CheckUniqueTradeID @segment,null,@accountID,@symbol1,@tradedqty,@tradeprice,@transtype,
@tradetime,@traderID,@locationID,@orderentrytime,@process1,@isin,@Result out
if @Result = 1
begin
insert into [dbo].[consolidated](segment,tradeID,accountID,symbol1,
tradedqty,tradeprice,transtype,tradetime,traderID,locationID,
tradevalue,orderentrytime,process1,isin)
select [segment],
CONVERT(VARCHAR(10),[tradeID])+[transtype] AS NewTrans,
[accountID],
[symbol]
,[tradedqty],
CASE WHEN [process1] = 1 THEN [tradeprice]/100 END AS [tradeprice],
case when [process1] =1 then case when [transtype] = 'B' THEN 1 WHEN [transtype] = 'S' THEN 2 end
end AS [transtype],
[tradetime1],
[traderID],
[locationID],
CASE WHEN [process1] = 0 THEN [tradedqty]*[tradeprice]
END AS [tradevalue],
[orderentrytime],
CASE WHEN [process1] = 0 THEN 1 ELSE 0 END AS [process1],
[isin]
from [dbo].[bse_trade] where process1 = 0
end
if @Result = 0
begin
exec UpdateParameters
end
update bse_trade set process1 = 2
where process1 = 1
end