NOTE: this is not done with any server side code but must be done from the Enterprise Manager or Query AnalyserI have an odd problem with my stored procedure. I want to pass into the procedure (in 1 parameter) a comma delimited list of ID numbers. The ID database field is type INTI know if the field type were VARCHAR I would do this...WHERE ID IN ('1,2,3')and if it is type INT I would do this...WHERE ID IN (1,2,3)
The problem the only way I can pass in the list of ids to the stored procedure is:myProc '1,2,3'
and the only datatype I can get to accept that is a VARCHAR (@Param1 VARCHAR(255)) but this causing an error because the ID field is INT and it can't convert the @Param1 to INT.my code isCREATE PROCEDURE myProc @Param1 VARCHAR(255)AS SELECT * FROM myTable WHERE ID IN (@Param1)
The specific errorSyntax error converting the varchar value '1,2,3' to a column of data type int.
Again ID is type INT and I have no control over this.Justin Bezansonwww.aspnetguy.com