Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IN Clause For Opening A Cursor

Status
Not open for further replies.

sunila7

Technical User
Apr 11, 2001
1,087
US
Hi,

I am trying to open a CURSOR in SQL SDERVER 7.0 which uses an in clause for opening the Cursor. is it possible to open a cursor like this.
The Select statement is not returning any rows now.

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


Thanks in advance for any help

Sunil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top