|
Write a stored procedure as follows:
CREATE PROCEDURE dbo.getPauseDays
@htongInfoIdx int
AS
declare @ p1 binary (16)
declare @ p2 binary (16)
create table # (c1 text)
insert # select ""
SELECT @ p1 = textptr (c1) FROM #
--Declare a cursor
DECLARE tb CURSOR LOCAL
FOR
SELECT textptr (pausedays)
FROM hetongpauseinfo where uidx = @htongInfoIdx
OPEN tb
FETCH tb INTO @ p2
WHILE @@ fetch_status = 0
BEGIN
UPDATETEXT # .c1 @ p1 NULL null hetongpauseinfo.pausedays @ p2
FETCH tb INTO @ p2
END
CLOSE tb
DEALLOCATE tb
select c1 from #
drop table #
GO
In the query analyzer, exec getPauseDays 12 can access the query set, but it doesn't work in the select statement. . select a. * from (getPauseDays 12) as a read like this will not work |
|