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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting varchar to int list in a Stored Proc

Status
Not open for further replies.

siituser

Programmer
Sep 30, 2002
67
0
0
CA
Hi there,
I'm passing in a list of numbers a varchar (2,3,4,5,6) into a stored proc but he SQL needs to convert the list to an integer data type.

CREATE PROCEDURE my_proc

@strBranchIDs varchar(255)

AS

SELECT Users.UserID,
Users.OfficeID,
Users.UserInitials,
Users.FullName


FROM Users

WHERE Active = 1
AND OfficeID IN (convert(int,@strBranchIDs))

I get an error "Syntax error converting the varchar value '3,2,5,6,4' to a column of data type int"

How can I get around this? Thanks

Kev




Return
GO
 
See faq183-3979 and/or faq183-5207.

-dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top