游标示例
DECLARE My_Cursor CURSOR FOR SELECT CellID,TableName FROM [dbo].[tblUpdateInfo] OPEN My_Cursor; DECLARE @CellID char(2) DECLARE @TableName varchar(50) FETCH NEXT FROM My_Cursor INTO @CellID,@TableName; WHILE @@FETCH_STATUS = 0 BEGIN PRINT @CellID PRINT @TableName FETCH NEXT FROM My_Cursor INTO @CellID,@TableName; END; CLOSE My_Cursor; DEALLOCATE My_Cursor;