473,385 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Passing multiple values into a stored procedure...

This may be a quick fix post...
----------------------------
I am having trouble passing multiple values into stored procedure. Here it is below:

CREATE Procedure spGetAssociateds
(
@PDSI int
)
AS

Create Table #tmpFlat01
(
PDSIAppliesTo int,
PDSIID int,
Name varchar(200),
Description varchar(1000),
Images varchar(400),
Imprint varchar(1000),
Shipping varchar(1000),
Catalog varchar(1000),
Ordering varchar(1000),
General varchar(1000),
Qty varchar(200),
Price varchar(200),
Discount varchar(200)
)

Insert Into #tmpFlat01 (PDSIID)
Select ptp.PDSIID
From ProductsToPage ptp
Inner Join Page p on ptp.pageID = p.pageID
Inner Join Catalog c on p.catID = c.catID
Where ptp.PDSIID = @PDSI


SELECT pdsiid
from impactmaster.dbo.pdsiappliesto
Where appliestopdsiid in
(select pdsiid from #tmpFlat01)
GROUP BY pdsiid


GO
-------------------------------

When I execute this:
exec spgetassociateds '103511', '103352'
I receive the following error:
Server: Msg 8144, Level 16, State 2, Procedure spGetAssociateds, Line 0
Procedure or function spGetAssociateds has too many arguments specified.

When I execute this:
exec spgetassociateds '103511, 103352'
I receive the following error:
Server: Msg 8114, Level 16, State 1, Procedure spGetAssociateds, Line 0
Error converting data type varchar to int.

My stored procedure works when I pass in one value, but it fails whenever I pass in more than one.

I have seen some posts by Erland that seem to address this issue, but I still don't see where my stored procedure fails.

Please help!

Thanks,
Chari Clark
Sep 27 '06 #1
1 14942
savan
1
HEY CHARI U R PASSING 2 ARGUMENTS INSTEAD OF 1

DID U GET IT

PASS ONLY 1 IT WILL WORK



This may be a quick fix post...
----------------------------
I am having trouble passing multiple values into stored procedure. Here it is below:

CREATE Procedure spGetAssociateds
(
@PDSI int
)
AS

Create Table #tmpFlat01
(
PDSIAppliesTo int,
PDSIID int,
Name varchar(200),
Description varchar(1000),
Images varchar(400),
Imprint varchar(1000),
Shipping varchar(1000),
Catalog varchar(1000),
Ordering varchar(1000),
General varchar(1000),
Qty varchar(200),
Price varchar(200),
Discount varchar(200)
)

Insert Into #tmpFlat01 (PDSIID)
Select ptp.PDSIID
From ProductsToPage ptp
Inner Join Page p on ptp.pageID = p.pageID
Inner Join Catalog c on p.catID = c.catID
Where ptp.PDSIID = @PDSI


SELECT pdsiid
from impactmaster.dbo.pdsiappliesto
Where appliestopdsiid in
(select pdsiid from #tmpFlat01)
GROUP BY pdsiid


GO
-------------------------------

When I execute this:
exec spgetassociateds '103511', '103352'
I receive the following error:
Server: Msg 8144, Level 16, State 2, Procedure spGetAssociateds, Line 0
Procedure or function spGetAssociateds has too many arguments specified.

When I execute this:
exec spgetassociateds '103511, 103352'
I receive the following error:
Server: Msg 8114, Level 16, State 1, Procedure spGetAssociateds, Line 0
Error converting data type varchar to int.

My stored procedure works when I pass in one value, but it fails whenever I pass in more than one.

I have seen some posts by Erland that seem to address this issue, but I still don't see where my stored procedure fails.

Please help!

Thanks,
Chari Clark
Mar 2 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Bob | last post by:
I'm new to Access projects and SQL server and am not a veteran VB programmer. There's a cry for help! I'm attempting to print the current form on screen by using a command button which the user...
7
by: Anne | last post by:
hie there, i want to be able to pass multiple parameters to another page. currently, i am able to do so, but somehow i feel it is not the correct way to do it. below is part of what i have so far....
14
by: Microsoft | last post by:
I know how to call a finction and pass a parameter to it, but I don;t understand how to take the resulting output of the function and use it from the subroutine that called the function ...
12
by: Dennis D. | last post by:
Hello: I want a function to return three variables to the calling procedure: Private Function CalcTimes(ByVal iAddDays as Integer, ByVal iAddHours as Integer, ByVal iAddMins as Integer) As...
3
by: shara | last post by:
Hello there, I want to pass multiple values selected in a select box(HTML) to another php page.I tried doing in several ways but of no use.Can anybody please help me with this. The code i used...
0
by: Mervin Harshal | last post by:
I need to know a way to pipe the output of an sql (select )statement to a stored procedure. Eg: The stored procedure is sp_rsch_filters param1,param2,param3 Requirement is to pass param1,param2...
6
by: muhammadrashidmughal | last post by:
I need to know a way to pipe the output of an sql (select )statement to a stored procedure. Eg: The stored procedure is sp_rsch_filters param1,param2,param3 Requirement is to pass param1,param2...
2
by: hemantc87 | last post by:
i have created this function with a parameter offset and i want to access the database using stored procedure but the code and stored procedure i have written below is not working...what is the right...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.