如何在sql server中的存储过程中转换逗号分隔值 [英] how to convert comma separated value in stored procedure in sql server

查看:78
本文介绍了如何在sql server中的存储过程中转换逗号分隔值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

how to convert comma separated value in stored procedure in sql server







In

stored procedure



i有一个输入参数值,如1,2,3,5 ...





但我需要在过滤条件中查询WHERE子句('1','2','3','5',)





Plz可以帮助我做任何人


i have a input parameter values like this 1,2,3,5...


but i need to do in query in filter condition WHERE clause ('1','2','3','5',)


Plz can any one help me to do this

推荐答案

优先在这里提出这个问题,你试过在谷歌搜索一下吗?



我相信你需要

Prior to postig the question here, have you tried searching the same in Google?

I am sure you'll need
(1,2,3,5)



而不是


rather than

('1','2','3','5',)



最后的逗号没有任何意义,会导致语法错误。



几乎没有办法你可以做到这一点。

查看这些文章 -

[ ^ ]

将一个充满逗号分隔值的varchar传递给SQL Server IN函数 [ ^ ]



将逗号分隔(分隔)值作为参数传递给SQL Server中的存储过程
[ ^ ]



希望,它有帮助:)


The comma at the end doesn't make any sense and will result in syntax error.

There are few ways through which you can do this.
Check these articles-
Using comma separated value parameter strings in SQL IN clauses[^]
Passing a varchar full of comma delimited values to a SQL Server IN function[^]

Pass comma separated (delimited) values as Parameter to Stored Procedure in SQL Server
[^]

Hope, it helps :)


可以任何一个PLZ帮助我



can any one plz help me

i have a input parameter values like this 1,2,3,5...


but i need to do in query in filter condition WHERE clause ('1','2','3','5') 


这篇关于如何在sql server中的存储过程中转换逗号分隔值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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