zoukankan      html  css  js  c++  java
  • 逗号分割的字符串存储到临时表中


    DECLARE
    @items VARCHAR(max) DECLARE @temp_item VARCHAR(max) SET @items = '1,2,3,4,5,6' CREATE TABLE #temp_table(item INT) WHILE(len(@items) > 0) BEGIN IF (charindex(',', @items) = 0) BEGIN SET @temp_item = @items SET @items = '' END ELSE BEGIN SET @temp_item = LEFT(@items, charindex(',', @items)-1) SET @items = RIGHT(@items, len(@items) - len(@temp_item) -1) END INSERT INTO #temp_table VALUES(@temp_item) END SELECT * FROM #temp_table DROP TABLE #temp_table
    参数化查询中想传递一个逗号分割的字符串,不料无法实现 看到 懒惰的肥兔 介绍的几种方法 ,记录下 参考:http://www.cnblogs.com/lzrabbit/archive/2012/04/29/2475427.html
  • 相关阅读:
    matplotlib imshow
    django restframework Serializers
    python assert用法
    nginx 深入篇
    scrapy 中间件
    mysql 存储引擎
    scrapy 部署
    pyinstaller模块使用
    wechat 网页版通信全过程
    hadoop YARN
  • 原文地址:https://www.cnblogs.com/lyroge/p/2511588.html
Copyright © 2011-2022 走看看