如何在SQL中将逗号Delimated Varchar值分隔为int? [英] How to separate Comma Delimated Varchar value to int in SQL?

查看:97
本文介绍了如何在SQL中将逗号Delimated Varchar值分隔为int?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设@

@id Varchar(50)='12,1,2,5'

如何分隔每个值?在Sql

Suppose @
@id Varchar(50)='12,1,2,5'
how to separate Each Value ?? in Sql

推荐答案

看看这个:在SQL IN子句中使用逗号分隔值参数字符串 [ ^ ] - 它解释了如何在IN子句中使用它,但原理是相同的,无论如何你想用CSV字符串做什么。
Have a look at this: Using comma separated value parameter strings in SQL IN clauses[^] - it explains how to do it for use in an IN clause, but the principle is the same regardless of what you are trying to achive with the CSV string.


这篇关于如何在SQL中将逗号Delimated Varchar值分隔为int?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆