Users Pricing

forum

Home Forums Parameterizing an SQL IN clause? – MindStick

Parameterizing an SQL IN clause?

Anonymous User 3369 17 Apr 2013
Hi All!

How do I parameterize a query containing an IN clause with a variable number of arguments, like this one?

select * from Tags 
where Name in ('ruby','rails','scruffy','rubyonrails')
order by Count desc
In this query, the number of arguments could be anywhere from 1 to 5.

I would prefer not to use a dedicated stored procedure for this (or XML), but if there is some fancy SQL Server 2008 specific way of doing it elegantly, I am open to that.

Thanks in advance


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md