create table #tmp (id int)
declare @x int
set @x=1
while @x<=10
begin
insert into #tmp values(@x)
set @x=@x+1
end
declare tmpCursor CURSOR for
select * from #tmp
open tmpCursor
declare @id int
fetch next from tmpCursor into @id
while @@FETCH_STATUS =0
begin
print @id
fetch next from tmpCursor into @id
end
create
procedure
findName
AS
declare
@result
VARCHAR
(30)
begin
Declare
curStudentFee
Cursor
for
SELECT
NAME
FROM
SYSOBJECTS
WHERE
XTYPE=
'P'
;
Open
curStudentFee
Fetch
Next
From
curStudentFee
Into
@result
While ( @@Fetch_Status=0 )
begin
print
''
''
+@result+
''
''
+
','
;
Fetch
Next
From
curStudentFee
into
@result
end
Close
curStudentFee
Deallocate
curStudentFee
end