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:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
|
DECLARE CURSOR @cCursor FOR
SELECT
PORPortfolioId,
PORAccountId,
PROOrderDate,
dbo.GenerateFuturesPROOrderId(PORPortfolioId,PROOrderDate),
SECSecurityId,
SECExtendedDetailId,
BuySell,
ORDOrderTypeId,
Quantity,
Price,
Filled,
AverageFillPrice
FROM dbo.Temp_ORDPROOrder Where PROOrderDate = '20071130'
DECLARE @PORPortfolioId int
DECLARE @PORAccountId int
DECLARE @PROOrderDate datetime
DECLARE @GenerateFuturesPROOrderId int
DECLARE @SECSecurityId int
DECLARE @SECExtendedDetailId int
DECLARE @BuySell varchar(20)
DECLARE @ORDOrderTypeId int
DECLARE @Quantity int
DECLARE @Price money
DECLARE @Filled bit
DECLARE @AverageFillPrice money
FETCH NEXT FROM @cCursor INTO
@PORPortfolioId, @PORAccountId, @PROOrderDate, @GenerateFuturesPROOrderId,
@SECSecurityId, @SECExtendedDetailId, @BuySell, @ORDOrderTypeId,
@Quantity, @Price, @Filled, @AverageFillPrice
WHILE @@FETCH_STATUS = 0
BEGIN
INSERT INTO
dbo.ORDPROOrder
(
@PORPortfolioId,
@PORAccountId,
@PROOrderDate,
@GenerateFuturesPROOrderId,
@SECSecurityId,
@SECExtendedDetailId,
@BuySell,
@ORDOrderTypeId,
@Quantity,
@Price,
@Filled,
@AverageFillPrice
)
FETCH NEXT FROM @cCursor INTO
@PORPortfolioId, @PORAccountId, @PROOrderDate, @GenerateFuturesPROOrderId,
@SECSecurityId, @SECExtendedDetailId, @BuySell, @ORDOrderTypeId,
@Quantity, @Price, @Filled, @AverageFillPrice
END
CLOSE @cCursor
DEALLOCATE @cCursor
|