SPROC Question, what am I doing wrong?

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default SPROC Question, what am I doing wrong?

    Here's my SPROC.

    CREATE PROCEDURE UpdateHits
    AS
    DECLARE @Result AS int
    DECLARE @ResultDate AS datetime
    SET @Result = (SELECT HitCount FROM v2_hit WHERE Hitdate = @ResultDate)

    IF @Result <> ''
    BEGIN
    UPDATE v2_hit
    SET HitCount = HitCount + 1
    WHERE HitDate = @ResultDate
    END
    ELSE
    BEGIN
    INSERT INTO v2_hit
    (HitCount, HitDate)
    VALUES(1, @ResultDate)
    END
    GO


    And here's how Im calling it.

    <cfstoredproc procedure="UpdateHits" datasource="cart">
    <cfprocparam type="In" cfsqltype="CF_SQL_DATE" dbvarname="ResultDate"
    value="#createODBCDateTime(now())#">
    </cfstoredproc>

    I don't need any vars back, just trying to pass it a date.

    dj shane Guest

  2. Similar Questions and Discussions

    1. SPROC vs Inline Times.
      Hey guys. I have a page which is generating fairly lengthly reports. I understand most of the parsing time is being created from the many tr and...
    2. sproc in DW asp.net
      I am trying to create a dataset from a stored procedure. I am using the stored procedure dialog box but when I put in the values I get an...
    3. Passing in SubReport Sproc Parameters using ASP
      The following code works fine when previewing a Crystal report using ASP, EXCEPT when it gets to a report using a SubReport and its associated...
    4. Double Select after Insert in SPROC?
      Hi, What I want to do in my SPROC is to insert values into a table that are selected by a select statement. Like this: INSERT INTO dbo.tbl1...
    5. SPROC parameters
      Hi, I'm putting together a Stored Procedure. I need to build a select statement that grabs two column values from a table (single row) and then...
  3. #2

    Default Re: SPROC Question, what am I doing wrong?

    Hi Shane,

    The error says you're supplying a parameter to an SP that doesn't require one.
    It's correct.

    Change

    CREATE PROCEDURE UpdateHits
    AS
    DECLARE @Result AS int
    DECLARE @ResultDate AS datetime
    SET @Result = (SELECT HitCount FROM v2_hit WHERE Hitdate = @ResultDate)

    to

    CREATE PROCEDURE UpdateHits
    @ResultDate datetime
    AS
    DECLARE @Result AS int

    SET @Result = (SELECT HitCount FROM v2_hit WHERE Hitdate = @ResultDate)

    Params have to be declared before the AS word.

    HTH,



    philh Guest

  4. #3

    Default Re: SPROC Question, what am I doing wrong?

    I knew it was something simple, thanks a million
    dj shane Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139