DECLARE @id int;
DECLARE @title VARCHAR(256),@author VARCHAR(128);
SET @id=(SELECT TOP 1 id FROM @table1 ORDER BY id);
WHILE @id IS NOT NULL
BEGIN
SELECT
@title=title,
@author=author
FROM @table1
WHERE id=@id;
EXEC proc_xxx @id,@title,@author;
SET @id=(SELECT TOP 1 id FROM @table1 WHERE id>@id ORDER BY id);
END
------解决方案--------------------