Solved

Title: error: stored procedure has too many arguments specified

Posted on 2006-11-30
10
840 Views
Last Modified: 2012-06-27
HI

where am I going wrong ?

Here is my code from the asp page to execute the strored proc:


session("db").execute("exec bp_createcall '" & callid & "','Addition','" & request("mid") & "','" & session("cscloggeduser") & "','" & request("custid" & cstr(i)) & "','" & request("desc") & "','" + request("add1") & "','" + request("add2") & "','" + request("add3") & "','" & request("refrenceno") & "'")


I am passing 10 arguments.

Here is my strored proc:

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO





ALTER procedure [dbo].[BP_createcall]
@callid varchar(8),
@calltype varchar(100),
@custid varchar(100),
@technician varchar(100),
@edc varchar(100),
@desc varchar(1000),
@add1 varchar(100),
@add2 varchar(100),
@add3 varchar(100),
@refrenceno varchar (25)

as

declare @hs int
declare @nowdate varchar(10)
declare @nowtime varchar(8)
declare @pa1 varchar(100)
declare @pa2 varchar(100)
declare @pa3 varchar(100)
declare @pc varchar(10)
declare @a1 varchar(100)
declare @a2 varchar(100)
declare @a3 varchar(100)
declare @country varchar(100)
declare @province varchar(100)
declare @name varchar(100)
declare @trading varchar(100)
declare @status varchar(100)
declare @slazone varchar(100)
declare @city varchar(100)
declare @tel varchar(100)
declare @fax varchar(100)
declare @contact varchar(100)
declare @contactcell varchar(100)
declare @contactemail varchar(100)
declare @bank varchar(100)
declare @application varchar(10)
declare @amex varchar(10)
declare @diners varchar(10)
declare @visa varchar(10)
declare @master varchar(10)
declare @fleet varchar(10)
declare @fastnet varchar(10)
declare @cashback varchar(10)
declare @cashlimit varchar(10)
declare @other varchar(10)
declare @privatelabel varchar(10)
declare @chequeveri varchar(10)
declare @bonus varchar(10)
declare @debitcard varchar(10)
declare @keycard varchar(10)
declare @manualauth varchar(10)
declare @apptype varchar(100)
Declare @userid varchar (10)
declare @termtype varchar(100)
declare @modemtype varchar(100)
declare @merchid varchar(100)

Select @refrenceno=subset.refrenceno from inserted

select @a1 = physical_address1,@a2 = physical_address2,@a3 = physical_address3, @pa1 = postal_address1,
@pa2 = postal_address2, @pa3 = postal_address3,@pc = postal_addresscode,@country = country,@province = province,
@name = name,@trading = tradingname,@status = status,@slazone = slazone,@city = city,@tel = telephone,@fax = fax,
@contact = contact,@contactcell = contactcell,@contactemail = contactemail,@bank = bank,@application = application,
@apptype = applicationtype
from profile where custid = @custid


set @hs = datediff(ss,'1970-01-01',getutcdate())
set @nowdate = convert(varchar(10),getdate(),120)
set @nowtime = convert(varchar(8),getdate(),108)

set @callid = left('00000000',8-len(@callid)) + @callid

if len(@add1) > 0 or len(@add2) > 0 or len(@add3) > 0
begin
            set @pa1 = @add1
            set @pa2 = @add2
            set @pa3 = @add3
end



insert into subset
(custid,
callid,
custtype,
refrenceno,
physical_address1,
physical_address2,
physical_address3,
postal_address1,
postal_address2,
postal_address3,
postal_addresscode,
country,
province,
name,
tradingname,
status,
slazone,
city,
telephone,
fax,
contact,
contactcell,
contactemail,
bank,
application,
applicationtype,
technician)
values
(@custid,
@callid,
'BP',
@refrenceno,
@a1,
@a2,
@a3,
@pa1,
@pa2,
@pa3,
@pc,
@country,
@province,
@name,
@trading,
@status,
@slazone,
@city,
@tel,
@fax,
@contact,
@contactcell,
@contactemail,
@bank,
@application,
@apptype,
@technician)

insert into calllog
(callid,
custid,
custtype,
calltype,
callstatus,
priority,
cduration,
callcount,
stopwatch,
recvddate,
recvdtime,
recvdby,
moddate,
modtime,
modby,
dtlastmod,
callsource,
category,
calldesc,
tracker)
values
(@callid,
@custid,
'BP',
@calltype,
'Open',
'1',
0,
0,
0,
@nowdate,
@nowtime,
@technician,
@nowdate,
@nowtime,
@technician,
@hs,
'Web',
'',
@desc,
@technician)

if not exists(select * from detail where callid = @callid)
begin
      if @calltype = 'Addition' or @calltype = 'Installation'
      begin
            insert into detail (callid,proposed_new_userid)
            values (@callid,@edc)
      end
      else
      begin
            select @termtype = terminaltype, @modemtype = modemtype, @apptype = applicationtype, @merchid = merchantnumber, @userid = userid
            from profile where custtype = 'Equipment' and custid = @edc

            insert into detail (callid,terminalsn,terminaltype,modemtype,applicationtype,merchantnumber,userid)
            values (@callid,@edc,@termtype,@modemtype,@apptype,@merchid,@userid)
      end
end

return @callid





GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO



0
Comment
Question by:Tiaanvanniekerk
10 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 18051931
I am not sure about the asp syntax, can you try prefixing the object owner

session("db").execute("exec dbo.bp_createcall '" & callid & "','Addition','" & request("mid") & "','" & session("cscloggeduser") & "','" & request("custid" & cstr(i)) & "','" & request("desc") & "','" + request("add1") & "','" + request("add2") & "','" + request("add3") & "','" & request("refrenceno") & "'")
0
 

Author Comment

by:Tiaanvanniekerk
ID: 18051954
Hi
I did and still the same problem if I take one of the arguments out it works but I have to pass all of them
0
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 168 total points
ID: 18052060
run sql server profiler first and then run this applicatio, check what's coming in the sql server profiler
0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 29

Expert Comment

by:Nightman
ID: 18052164
You passing in a string - does any of those variable values have a comma in it?
0
 
LVL 14

Assisted Solution

by:puranik_p
puranik_p earned 166 total points
ID: 18052191
my guess is, you are getting a ',' in the value of one of the parameters which is being interpreted as another parameter.
Why don't you go the parameter way ...?

pasted from http://support.microsoft.com/kb/q164485/

<%
   Set cn = Server.CreateObject("ADODB.Connection")
   cn.Open "data source name", "userid", "password"
   Set cmd = Server.CreateObject("ADODB.Command")
   Set cmd.ActiveConnection = cn
   cmd.CommandText = "sp_test"
   cmd.CommandType = adCmdStoredProc
   cmd.Parameters.Append cmd.CreateParameter("RetVal", adInteger, _
      adParamReturnValue)
   cmd.Parameters.Append cmd.CreateParameter("Param1", adInteger, _
      adParamInput)
   ' Set value of Param1 of the default collection to 22
   cmd("Param1") = 22
   cmd.Execute
   %>
   Calling via method 2<BR>
   ReturnValue = <% Response.Write cmd(0) %><P>


This is the safest way to call a procedure.

Pura
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 166 total points
ID: 18058255
One of your Request variables must be Null.  For trouble shooting purposes only add the following prior to the Execute method:
Response.Write "exec bp_createcall '" & callid & "','Addition','" & request("mid") & "','" & session("cscloggeduser") & "','" & request("custid" & cstr(i)) & "','" & request("desc") & "','" + request("add1") & "','" + request("add2") & "','" + request("add3") & "','" & request("refrenceno") & "'" & "<br>"
Response.End

If the reason is not obvious, post the output here.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
string fuctions 4 26
Deal with apostrophe in stored procedures 8 43
Insert query into temp tables using Coldfusion 3 22
Help to build a Proc... 6 21
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question