格式化字符串的SQL IN子句子句、字符串、SQL、IN

2023-09-06 14:44:48 作者:就老去吧,孤独别醒来

我需要格式化字符串,并在将其作为参数的SQL IN子句,如:

I need to format a string and pass it in as parameter for a SQL IN clause such as:

从表*其中X在(@参数1)

Select * from Table Where X In (@param1)

这是传过来的参数文本字符串看起来是这样的:

The literal string that is passed in as a param looks like this:

项目1,项目2,项目3

"Item1, Item2, Item3"

似乎这不工作。有什么建议么?谢谢!

This does not seem to work. Any suggestions? Thanks!

推荐答案

我相信你想做什么都可以在这里找到:

I believe what you want to do can be found here:

一个参数化SQL IN子句