Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameterized Queries - Conversion problem for the IN clause

Status
Not open for further replies.

NewTerminator

Programmer
Apr 28, 2003
22
IN
I have an sql statment that looks like the one below:

declare @IDs varchar(100)
set @IDs = '''113''' + ',' + '''115'''

select *
from Student
where convert(varchar(30),cid) in (@IDs)

the cid column is of type int. print @IDs returns me '113','115', but i am still not able to retrieve records. Manually giving the numbers in the in clause returns records.

What is wrong in this statment.

Any help would be appreciated.
 
This FAQ describes how to do this:

Passing a list of values to a Stored Procedure
faq183-3979

--James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top