Tuesday, February 10, 2009

SQL script to research CRD Derivative Trading Setup


select 'security', PARENT_SEC_ID, SEC_TYP_CD,* from CRD822Deriv..CSM_SECURITY where SEC_NAME like'%JQD%'

declare @SEC_ID int, @U_SEC_ID int

select @SEC_ID=10465198

select @U_SEC_ID=10012552

select 'sec_legs', PARENT_SEC_ID,SEC_TYP_CD,SWAP_LEG_IND,* from Deriv..CSM_SECURITY where PARENT_SEC_ID=@SEC_ID




select 'u_security', * from CSM_UNDERLYING_SECURITY where SEC_ID =@SEC_ID

select 'position', * from CS_POSITION where SEC_ID in (@SEC_ID ,@U_SEC_ID)

select 'sec_cust', * from CSM_Security_Cust where SEC_ID =@SEC_ID

select 'sec_parent_underlying',* from CSM_SECURITY where SEC_ID in (@SEC_ID ,@U_SEC_ID)


select 'order',* from TS_ORDER where SEC_ID in (@SEC_ID ,@U_SEC_ID)

select 'ord_alloc', * from TS_ORDER_ALLOC where ORDER_ID in (select ORDER_ID from TS_ORDER where SEC_ID in (@SEC_ID ,@U_SEC_ID))

select 'term',* from CSM_SECURITY_TERM where SEC_ID in (@SEC_ID ,@U_SEC_ID)

No comments: