Error 8144 - Too Many Arguments Specified

  • Hi I am receiving this error Error 8144 - Too Many Arguments Specified when running a stored procedure. Here is the code maybe someone will see something obvious. I am new to this so am sure it's something that i have done wrong.

    Thanks for any help

    USE [wce_sqlexpress]

    GO

    /****** Object: StoredProcedure [dbo].[activity_delete] Script Date: 09/29/2008 09:56:47 ******/

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    ALTER procedure [dbo].[activity_delete]

    @activityid varchar(16)

    AS

    declare @atype varchar(100)

    declare @creationtime datetime

    declare @contactid varchar(25)

    declare @duration varchar(50)

    declare @subject varchar(50)

    declare @notes varchar(254)

    declare @utable varchar(50)

    set @atype = (SELECT atype FROM wce_activity WHERE UNIQUEID = @ACTIVITYID)

    set @creationtime = (SELECT createtime FROM wce_activity WHERE UNIQUEID = @ACTIVITYID)

    set @contactid = (SELECT createuser FROM wce_activity WHERE UNIQUEID = @ACTIVITYID)

    set @duration = (SELECT duration FROM wce_activity WHERE UNIQUEID = @ACTIVITYID)

    set @subject = (SELECT subject FROM wce_activity WHERE UNIQUEID = @ACTIVITYID)

    set @notes = (SELECT notes FROM wce_activity WHERE UNIQUEID = @ACTIVITYID)

    set @utable = 'wce_history'

    UPDATE wce_linkto SET LUTABLENAME = @utable WHERE LUNIQUEID = @ACTIVITYID

    INSERT INTO wce_history (uniqueid, ATYPE, CREATETIME, CREATEUSER, DURATION, SUBJECT, NOTES, EDITTIME, EDITUSER, RECORDEDFOR, RECORDEDTIME)

    VALUES (@ACTIVITYID, @atype, @creationtime, @contactid, @duration, @subject, @notes, @creationtime, @contactid, @contactid, @creationtime)

    DELETE FROM wce_activity where uniqueid = @ACTIVITYID

  • You're getting that just when calling the stored proc or when you run the alter?

    If the former, can you send your command you're using to call it?

    Have you checked to see if there are more than one record returned for your variable selection? (Duplicate @ACTIVITYID columns)

    set @atype = (SELECT atype FROM wce_activity WHERE UNIQUEID = @ACTIVITYID)

    set @creationtime = (SELECT createtime FROM wce_activity WHERE UNIQUEID = @ACTIVITYID)

    set @contactid = (SELECT createuser FROM wce_activity WHERE UNIQUEID = @ACTIVITYID)

    set @duration = (SELECT duration FROM wce_activity WHERE UNIQUEID = @ACTIVITYID)

    set @subject = (SELECT subject FROM wce_activity WHERE UNIQUEID = @ACTIVITYID)

    set @notes = (SELECT notes FROM wce_activity WHERE UNIQUEID = @ACTIVITYID)

    set @utable = 'wce_history'

    Also, you're running 6 queries to set variables from the same table. You could do it in one query like this:

    Select @atype = atype,

    @creationtime,

    @contactid,

    @duration,

    @subject,

    @notes = notes,

    @utable = 'wce_history'

    FROM wce_activity WHERE UNIQUEID = @ACTIVITYID

    Chris.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply