sql 遍历记录

来源:互联网 发布:劳务派遣软件下载 编辑:程序博客网 时间:2024/06/05 06:19
declare @tempId  varchar(100) ,@tempName  varchar(100)declare @tmpTB table([SheBeiId] varchar(100))insert  into @tmpTB ([SheBeiId]) select distinct [SheBeiId] from  [IpcDebugLog]while exists (select SheBeiId from @tmpTB)beginprint '--1---'set ROWCOUNT 1            SELECT @tempId=[SheBeiId] FROM @tmpTBset ROWCOUNT 0delete from @tmpTB where [SheBeiId]=@tempIdprint '[SheBeiId]:----'+@tempId end


原创粉丝点击