Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Multiple Integer Query

Author  Topic 

Wildthing
Starting Member

4 Posts

Posted - 2001-07-09 : 19:53:28
I have a stored procedure that queries an Integer column (CompanyID) with a comma-delimeted varchar input parameter (@strID).

DECLARE @strID varchar(200)
SET @strID = '1,2,3,4'
SELECT * FROM Company
WHERE CompanyID IN (@strID)

This causes the following error -
"Syntax error converting the varchar value '1,2,3,4' to a column of data type int."

Any ideas on how to pass a comma-delimeted parameter and use it to query an integer column?

Thanks in advance.
Wildthing

   

- Advertisement -