declare @IDList as varchar(max)
declare @ID as int
declare @i as int
set @IDList='' select @IDList=@IDList + cast(id as varchar(50)) + ',' from table
while CharIndex(',',@IDList)<>0
Begin
set @ID = SubString(@IDList,1,CharIndex(',',@IDList)-1)
print(@ID) set @IDList = Replace(','+@IDList,','+Cast(@ID as nvarchar(50))+',','')
End

tsql 循环id读取的更多相关文章

  1. T-SQL开发——ID处理篇

    原文:T-SQL开发--ID处理篇 数据库自增ID功能中Identity.Timestamp.Uniqueidentifier的区别: 问题现象: 一般序号的产生,对于一般程序员而言,都是使用T-SQ ...

  2. T-SQL 循环表的一种方式

    原文来自:https://www.lesg.cn/netdaima/sqlservert-sql/2016-463.html SsqlServer 中循环表有几种方式 1.临时表 2.游标 3-. 下 ...

  3. STM32全球唯一ID读取方法

    产品唯一的身份标识非常适合:● 用来作为序列号(例如USB字符序列号或者其他的终端应用)● 用来作为密码,在编写闪存时,将此唯一标识与软件加解密算法结合使用,提高代码在闪存存储器内的安全性.● 用来激 ...

  4. MySQL实现根据当前ID读取上一条和下一条记录

    以下为MySQL语句演示: SELECT * FROM t_news AS n ORDER BY n.`News_ID` 当前ID为4,读取上一条记录: ,; 当前ID为4,读取下一条记录: ,; 其 ...

  5. 织梦按栏目id读取banner图

    <div class="pic"> <div class="banner"> {dede:type} <div><a ...

  6. 循环 for 读取文件

    cat filename(待读取的文件) | while read line do echo $line done

  7. TP5用join进行查询出来后的循环id都是一样的

    这是因为join将两个表的所有字段都查询,id冲突了,所以需要设置名,或指定选择一个表的id 用field('a.*')

  8. 由于vue的for循环id并不严谨,提高id严谨性

    如果后台没有传入id,我们拿到的数据没有id修改等操作不方便,如何拿到id呢 https://github.com/dylang/shortid 提供唯一id 插件的引入和使用: <templa ...

  9. 同时读取两个文件进行while循环

    知识点:文件对象提供了三个“读”方法: .read()..readline() 和 .readlines().每种方法可以接受一个变量以限制每次读取的数据量,但它们通常不使用变量. 问题描述: 我们的 ...

随机推荐

  1. myeclipse 与 webstrom 免解析node_modules 的方法

    myeclipse :   1.项目文件夹上:右键  properites  - > 搜索 filter  -->resouce filters 2.  webStrom : File - ...

  2. 使用dig命令解析域名

    Linux下解析域名除了使用nslookup之外,开可以使用dig命令来解析域名,dig命令可以得到更多的域名信息. dig的全称是 (domain information groper).它是一个用 ...

  3. QT4 交叉编译

    配置 ./configure \-prefix /usr \-no-rpath \-embedded arm \-xplatform /qws/linux-arm-gnueabi-g++ \-dept ...

  4. 【opencv基础】图像翻转cv::flip详解

    前言 在opencv中cv::flip函数用于图像翻转和镜像变换. 具体调用形式 void cv::flip( cv::InputArray src, // 输入图像 cv::OutputArray ...

  5. [LeetCode&Python] Problem 617. Merge Two Binary Trees

    Given two binary trees and imagine that when you put one of them to cover the other, some nodes of t ...

  6. android 自动拨打电话 挂断电话代码

    页面布局文件代码  (  res下面的layout下面的activity_main.xml代码 ) <RelativeLayout xmlns:android="http://sche ...

  7. smarty学习——高级知识

    1.Objects 对象 smarty允许通过模板访问PHP对象.有两种方式来访问它们.一种是注册对象到模板,然后通过类似于用户自定义函数的形式来访问它. 另一种方法给模板分配对象,然后通过访问其它赋 ...

  8. Spring核心思想:“控制反转”,也叫“依赖注入” 的理解

    @Service对应的是业务层Bean,例如: @Service("userService") public class UserServiceImpl implements Us ...

  9. telinit:Did not receive a reply.Possible causes include:the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired

    问题: Enabling /etc/fstab swaps: [ok]telinit:Did not receive a reply.Possible causes include:the remot ...

  10. Flyway 简单入门教程

    原文地址:Flyway 简单入门教程 博客地址:http://www.extlight.com 一.前言 Flyway 是一款开源的数据库版本管理工具,它更倾向于规约优于配置的方式.Flyway 可以 ...