hi, i am new to sql , so pls forgive if this is too naive
DECLARE @CUSIP VARCHAR(50)
--set @cusip='abc us equity'
DECLARE @DECLARE VARCHAR(10)
--set @dealer='gsco'
DECLARE @BID FLOAT
--set @bid=50
DECLARE @ASK FLOAT
--set @ask=50
DECLARE @STOCK_REF_PX FLOAT
--set @stock_ref_px=50
DECLARE @GET5Y_REF_PX FLOAT
--set @get5y_ref_px=0.05
DECLARE @UPDATE_DATE DATETMIE
--set @update_date='10/06/04'
DECLARE @INST_ID INT
DECLARE @DEALER_ID INT
DECLARE @MARK_ID INT
SET @DEALER_ID = (SELECT DEALER_ID FROM HEDGEHOG_DEALERS WHERE DEALER_NAME = @DEALER)
SET @MARK_ID = (SELECT MAX(MARK_ID)+1 FROM HEDGEHOG_MARKS)
DECLARE CR_INST_ID CURSOR LOCAL FORWARD_ONLY FAST_FORWARD READ_ONLY
FOR SELECT DISTINCT INST_ID
FROM HEDGEHOG_INSTRUMENTS
WHERE INST_ID IN
(SELECT INST_ID
FROM HEDGEHOG_CUSIPS
WHERE CUSIP=@CUSIP)
FOR {READ ONLY}
OPEN CR_INST_ID
FETCH NEXT FROM CR_INST_ID INTO @INST_ID
WHILE @@FETCH_STATUS
BEGIN
INSERT INTO HEDGEHOG_MARKS (INST_ID, DEALER_ID, BID, ASK, STOCK_REF_PX, GET5Y_REF_PX, UPDATE_DATE, MARK_ID)
VALUES (@INST_ID,@DEALER_ID,@BID,@ASK,@STOCK_REF_PX,@GET5Y_REF_PX,@UPDATE_DATE,@MARK_ID)
SET @MARK_ID=MARK_ID+1
END
CLOSE CR_INST_ID
DEALLOCATE CR_INST_ID
DECLARE @CUSIP VARCHAR(50)
--set @cusip='abc us equity'
DECLARE @DECLARE VARCHAR(10)
--set @dealer='gsco'
DECLARE @BID FLOAT
--set @bid=50
DECLARE @ASK FLOAT
--set @ask=50
DECLARE @STOCK_REF_PX FLOAT
--set @stock_ref_px=50
DECLARE @GET5Y_REF_PX FLOAT
--set @get5y_ref_px=0.05
DECLARE @UPDATE_DATE DATETMIE
--set @update_date='10/06/04'
DECLARE @INST_ID INT
DECLARE @DEALER_ID INT
DECLARE @MARK_ID INT
SET @DEALER_ID = (SELECT DEALER_ID FROM HEDGEHOG_DEALERS WHERE DEALER_NAME = @DEALER)
SET @MARK_ID = (SELECT MAX(MARK_ID)+1 FROM HEDGEHOG_MARKS)
DECLARE CR_INST_ID CURSOR LOCAL FORWARD_ONLY FAST_FORWARD READ_ONLY
FOR SELECT DISTINCT INST_ID
FROM HEDGEHOG_INSTRUMENTS
WHERE INST_ID IN
(SELECT INST_ID
FROM HEDGEHOG_CUSIPS
WHERE CUSIP=@CUSIP)
FOR {READ ONLY}
OPEN CR_INST_ID
FETCH NEXT FROM CR_INST_ID INTO @INST_ID
WHILE @@FETCH_STATUS
BEGIN
INSERT INTO HEDGEHOG_MARKS (INST_ID, DEALER_ID, BID, ASK, STOCK_REF_PX, GET5Y_REF_PX, UPDATE_DATE, MARK_ID)
VALUES (@INST_ID,@DEALER_ID,@BID,@ASK,@STOCK_REF_PX,@GET5Y_REF_PX,@UPDATE_DATE,@MARK_ID)
SET @MARK_ID=MARK_ID+1
END
CLOSE CR_INST_ID
DEALLOCATE CR_INST_ID