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)
 Can we use an IN clause when we are opening a Cursor inside the Stored procedure

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-05-23 : 21:06:27
Sunil A writes "hi,
I tried to put an IN clause in the CURSOR inside a Stored Procedure. but the stored procedure is not returning anything.
is it possible to do this

CREATE PROCEDURE Hello AS
Declare @ChargetypeCode as Char(3)

Declare @Description as char(100)
set @ChargeTypeCode = 'BPF'+"," +'SOP'

--print (@ChargeTypeCode)
Declare Chargetype cursor for
select stockid from charge where chargetypecode in (@ChargeTypeCode)

open ChargeType

BEGIN
FETCH NEXT FROM Chargetype INTO @Description
WHILE @@FETCH_STATUS = 0
BEGIN
print @Description
END
FETCH NEXT FROM Chargetype INTO @Description
END
Close chargetype
Deallocate ChargeType

thank you"
   

- Advertisement -