Passing comma seperated values to a stored proc
From: M Smith (msmith_at_avma.org)
Date: 12/22/04
- Next message: Anith Sen: "Re: combining rows and deleting those that match leaving one"
- Previous message: Gigio: "Porting of Oracle cursor structure in T-SQL"
- Next in thread: Keith Kratochvil: "Re: Passing comma seperated values to a stored proc"
- Reply: Keith Kratochvil: "Re: Passing comma seperated values to a stored proc"
- Reply: Alejandro Mesa: "RE: Passing comma seperated values to a stored proc"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 22 Dec 2004 10:39:06 -0600
I have an application where the user will type in ID numbers into a single
field in an ASP page. They can type in multiple IDs if they are seperated
by a comma. I want to pass this string into a Stored Proc and just use an
"in" command in the where clause to return a recordset back to the ASP page.
The problem is that the ID numbers are integer and the parameter is a
varchar. When I try to pass multiple IDs into the Stored Proc I get an
error.
Here is the Stored Proc
CREATE PROCEDURE test @pvID as varchar(500) AS
Select * from member_t where member_ID in (@pvID)
GO
When I try it by typing - exec test '123456,123457,123458' - I get this
error
"Syntax error converting the varchar value '123456,123457,123458' to a
column of data type int."
How would I go about converting the string to an integer and still use the
In statement.
Thanks
- Next message: Anith Sen: "Re: combining rows and deleting those that match leaving one"
- Previous message: Gigio: "Porting of Oracle cursor structure in T-SQL"
- Next in thread: Keith Kratochvil: "Re: Passing comma seperated values to a stored proc"
- Reply: Keith Kratochvil: "Re: Passing comma seperated values to a stored proc"
- Reply: Alejandro Mesa: "RE: Passing comma seperated values to a stored proc"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|