Falsely getting "Too many arguments" error for my

Results 1 to 2 of 2

Thread: Falsely getting "Too many arguments" error for my

  1. #1
    Join Date
    Dec 1969

    Default Falsely getting "Too many arguments" error for my

    I have a stored proceedure that gives me a "Procedure or function sp_Affiliates_by_hits_paged has too many arguments specified" if I call it from a website. <BR><BR>If I response.write the SQL statement used in the website and cut and paste it into Query Analyzer everything works fine.<BR><BR>I&#039;m not sure what the problem is. The SP wants 4 args and that is what I give it.<BR><BR>Here is how I call it and the code for the SP itself:<BR><BR>exec sp_Affiliates_by_hits_paged @Page=1,@RecsPerPage=30,@StartDate=&#039;12/7/2004 00:00:00&#039;,@EndDate=&#039;12/25/2004 12:59:59&#039; <BR><BR><BR>CREATE PROCEDURE sp_Affiliates_by_hits_paged<BR><BR> (<BR> @Page int,<BR> @RecsPerPage int,<BR> @StartDate varchar(50),<BR> @EndDate varchar(50)<BR> )<BR>AS<BR><BR>-- We don&#039;t want to return the # of rows inserted<BR>-- into our temporary table, so turn NOCOUNT ON<BR>SET NOCOUNT ON<BR><BR><BR>--Create a temporary table<BR>CREATE TABLE #TempHits<BR>(<BR> ID int IDENTITY,<BR> AffiliateName varchar(100),<BR> AffiliateURL varchar(100),<BR> AffiliateContact varchar(100),<BR> HitCount int,<BR> AffiliateID int<BR>)<BR><BR><BR>-- Insert the rows from tblItems into the temp. table<BR>INSERT INTO #TempHits (HitCount, AffiliateID, AffiliateName, AffiliateURL, AffiliateContact)<BR>SELECT COUNT(*) AS hitcount, AFFILINFO.AffiliateID, AFFILINFO.site_name, AFFILINFO.site_url, AFFILINFO.contact_name<BR>FROM Hits INNER JOIN<BR> AFFILINFO ON CAST(Hits.resellid AS char(100)) = CAST(AFFILINFO.AffiliateID AS char(100))<BR>WHERE (Hits.hitdate &#062;= CONVERT(DATETIME, LTRIM(RTRIM(@StartDate)), 102)) AND (Hits.hitdate &#060;= CONVERT(DATETIME, LTRIM(RTRIM(@EndDate)), 102))<BR>GROUP BY Hits.resellid, AFFILINFO.AffiliateID, AFFILINFO.site_name, AFFILINFO.site_url, AFFILINFO.contact_name<BR>ORDER BY hitcount DESC<BR><BR>-- Find out the first and last record we want<BR>DECLARE @FirstRec int, @LastRec int<BR>SELECT @FirstRec = (@Page - 1) * @RecsPerPage<BR>SELECT @LastRec = (@Page * @RecsPerPage + 1)<BR><BR>-- Now, return the set of paged records, plus, an indiciation of we<BR>-- have more records or not!<BR>SELECT *,<BR> MoreRecords = <BR> (<BR> SELECT COUNT(*)<BR> FROM #TempHits TH<BR> WHERE TH.ID &#062;= @LastRec<BR> ) <BR>FROM #TempHits<BR>WHERE ID &#062; @FirstRec AND ID &#060; @LastRec<BR><BR><BR>-- Turn NOCOUNT back OFF<BR>SET NOCOUNT OFF<BR>GO<BR>

  2. #2
    Join Date
    Dec 1969

    Default try like this

    exec sp_Affiliates_by_hits_paged 1, 30, &#039;12/7/2004 00:00:00&#039;,&#039;12/25/2004 12:59:59&#039;<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts