Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SELECT statement

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-04-21 : 20:54:00
Chin writes "I have a stored proc like this:

CREATE PROCEDURE pf_AddNewBORec
(
@iPFID as int,
@sCon as varchar(300),
@sRemCode as varchar(3)
)
AS
DECLARE @sClientNo varchar(9)
DECLARE @sConno varchar(10)
DECLARE @sStockNo varchar(6)
DECLARE @sPDate char(10)
DECLARE @iQty int
DECLARE @dPrice decimal(7,3)
DECLARE @iUID int

DECLARE bo_cursor CURSOR FOR
SELECT client_code, con_no,counter_code,con_date,unit_price,con_qty FROM tblBOContract
WHERE con_no IN (@sCon) AND rem_code=@sRemCode

OPEN bo_cursor

FETCH NEXT FROM bo_cursor INTO
@sClientNo,@sConno,@sStockNo,@sPDate,@dPrice,@iQty

WHILE @@FETCH_STATUS=0
BEGIN
SELECT @iUID=ISNULL(Max(uid),0) FROM tblPortfolio
SET @iUID=@iUID+1
INSERT INTO tblPortfolio(uid,portfolioid,clientno,stockno,con_no,p_date,p_price,p_qty) VALUES
(@iUID,@iPFID,@sClientNo,@sStockNo,@sConno,@sPDate,@dPrice,@iQty)

FETCH NEXT FROM bo_cursor INTO
@sClientNo,@sConno,@sStockNo,@sPDate,@dPrice,@iQty
END
CLOSE bo_cursor
DEALLOCATE bo_cursor

I pass the values @sCon as CO001,CI002
The problem is I have both the record in the table, but it didn't return any of them to me. What is wrong?


TQ"
   

- Advertisement -