Unix Technical Forum

Sending data to a Stored Procedure with ASP error

This is a discussion on Sending data to a Stored Procedure with ASP error within the SQL Server forums, part of the Microsoft SQL Server category; --> Hi all.. I'm trying to send multiple INT values to a Stored Procedure that will be handled in an ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 07:26 AM
mikeyatsony@gmail.com
 
Posts: n/a
Default Sending data to a Stored Procedure with ASP error

Hi all..

I'm trying to send multiple INT values to a Stored Procedure that will
be handled in an IN statement.

ASP Code:
strSQL = "SP_Get_Selections '29, 32'

where 29 and 32 are 2 integer values

Now, in my stored procedure... I would like to look these values up in
an IN statement like

CREATE Procedure SY_GET_SELECTIONS
@authorid varchar(20)
SELECT * FROM Authors WHERE AuthorID IN (@authorid)

But when I use this, I get [Microsoft][ODBC SQL Server Driver][SQL
Server]Syntax error converting the varchar value '29, 32' to a column
of data type int.

Any help would be great.
Thanks

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 07:26 AM
Simon Hayes
 
Posts: n/a
Default Re: Sending data to a Stored Procedure with ASP error


<mikeyatsony@gmail.com> wrote in message
news:1115842205.805890.34120@g47g2000cwa.googlegro ups.com...
> Hi all..
>
> I'm trying to send multiple INT values to a Stored Procedure that will
> be handled in an IN statement.
>
> ASP Code:
> strSQL = "SP_Get_Selections '29, 32'
>
> where 29 and 32 are 2 integer values
>
> Now, in my stored procedure... I would like to look these values up in
> an IN statement like
>
> CREATE Procedure SY_GET_SELECTIONS
> @authorid varchar(20)
> SELECT * FROM Authors WHERE AuthorID IN (@authorid)
>
> But when I use this, I get [Microsoft][ODBC SQL Server Driver][SQL
> Server]Syntax error converting the varchar value '29, 32' to a column
> of data type int.
>
> Any help would be great.
> Thanks
>


http://www.sommarskog.se/arrays-in-sql.html

Simon


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:42 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com