By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,728 Members | 2,488 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,728 IT Pros & Developers. It's quick & easy.

Passing multiple values into a stored procedure...

P: 1
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
Share this Question
Share on Google+
1 Reply


P: 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

Post your reply

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