1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
IF(@vPortfolioID = 'DEVISES')
insert into #ResIDs
select ResultsID ,max(PartitionCode) from panorama..MarketSimPartitions where ResultsID in
(
select max(ResultsID) from panorama..PortfolioResults where PortfolioID IN ('SOPTIONS', 'LODTERM','DEVSPOT','DEVBLTS')
and ReferenceDate =@vRefDate
group by PortfolioID
)
and PartitionKeys in ('TOTAL|TOTAL', 'TOTAL|TOTAL|TOTAL')
group by ResultsID
ELSE IF (@vPortfolioID = 'DEPTAUX')
insert into #ResIDs
select ResultsID ,max(PartitionCode) from panorama..MarketSimPartitions where ResultsID in
(
select max(ResultsID) from panorama..PortfolioResults where PortfolioID IN ('ABOBLIG', 'PRIMOBLI','LOTXDER')
and ReferenceDate =@vRefDate
group by PortfolioID
)
and PartitionKeys in ('TOTAL|TOTAL', 'TOTAL|TOTAL|TOTAL')
group by ResultsID
ELSE IF (@vPortfolioID = 'OBLIG')
insert into #ResIDs
select ResultsID ,max(PartitionCode) from panorama..MarketSimPartitions where ResultsID in
(
select max(ResultsID) from panorama..PortfolioResults where PortfolioID IN ('ABOBLIG', 'PRIMOBLI')
and ReferenceDate =@vRefDate
group by PortfolioID
)
and PartitionKeys in ('TOTAL|TOTAL', 'TOTAL|TOTAL|TOTAL')
group by ResultsID |
Partager