在存储过程中,我们需要获取哪些列已通过值的行 [英] In stored procedure we need to get rows which column have passed values

查看:65
本文介绍了在存储过程中,我们需要获取哪些列已通过值的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在存储过程中,我们需要获取哪些列已经传递了值。



我在(@cid)中的列中使用

这个列类型是整数,我通过分隔符逗号传递值。

如何分割和代码单行



我用的地方(@custid)中的强制转换(columnname,varchar(50))。但没有结果。





In stored procedure we need to get rows which column have passed values.

I am used where column in (@cid)
This column type is integer , I am passed values by delimiter comma.
how can split and code in single line

I used where cast(columnname,varchar(50)) in (@custid). but getting no result.


.

推荐答案

你不需要在这里拆分值。您可以使用动态SQL来获取数据。





例如:



EXEC('select * from tablename where我在('+ @ cid +')')







请试试这个让我知道如果您有任何问题。
You need not split the values here. you can use dynamic SQL to fetch the data.


Eg:

EXEC('Select * from tablename where Id in('+@cid+')')



Please try this and let me know if you have any issues.


这篇关于在存储过程中,我们需要获取哪些列已通过值的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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