declare @deviceid intdeclare @facename nvarchar(20)declare @RecordCreateTime datetimedeclare cursor1 cursor for --定义游标cursor1select deviceid,facename,RecordCreateTime from FaceRecords --使用游标的对象(跟据需要填入select文)open cursor1 --打开游标fetch next from cursor1 into @deviceid,@facename,@RecordCreateTime --将游标向下移1行,获取的数据放入之前定义的变量@id,@name中while @@fetch_status=0 --判断是否成功获取数据begin --进行相应处理(跟据需要填入SQL文) print @deviceid fetch next from cursor1 into @deviceid,@facename,@RecordCreateTime --将游标向下移1行endclose cursor1 --关闭游标deallocate cursor1