Hi All

I have the following Stored Procedure that asks for parameter @CaseID in my table that is type INT but how can I insert the values in the parameter when I MUST use string as the variable as the IN statement it only accepts a "," (comma) to sperate the values.

for example

Code:
CREATEPROCEDURE [dbo].[spEvents]

	@CaseID nvarchar(10)

AS

SELECT     tblEvents.CaseID
FROM       tblEvents
WHERE     (tblEvents.CaseID IN (@CaseID))
But using the IN statement it accepts multiple values but it needs to be seperated by a comma "," therefor this becomes a string value. The below is the proper syntax for the IN statement

Code:
SELECT column_name(s)
FROM table_name
WHERE column_name IN (value1,value2,...)
so when I goto execute my stored procedure like

Code:
exec spEvents @CaseID = '21474,21475'
It comes back with the following error

Code:
Msg 245, Level 16, State 1, Procedure spEvents, Line 7
Conversion failed when converting the nvarchar value '21474,2147' to data type int.
Any ideas on how I can overcome this problem?

So if I use the statement as follows it works fine without the parameter

Code:
SELECT     tblEvents.CaseID
FROM       tblEvents
WHERE     (tblEvents.CaseID IN (21474,21475))