Help needed with insert stored procedure

Discussion in '.NET' started by sm2010, Apr 2, 2010.

  1. sm2010

    sm2010

    Joined:
    Mar 26, 2010
    Messages:
    2
    Hi All,

    i am having problems trying to run an stored procedure. i have two tables, and the one contains the foreign key of the other and i created an insert statement to inser the data in both tables. Can anyone please help me in solving this problem.

    Any help much appreciated. Thanks.

    here is the stored procedure code:
    ALTER PROCEDURE [dbo].[contractRoomDetails]


    @Duration varchar(10),
    @NoOfHours int,
    @RoomNo nchar(6),
    @Classroom varchar(3),
    @Hall varchar(3),
    @Date varchar(50),
    @StartTime varchar(50),
    @FinishTime varchar(50)

    AS
    BEGIN
    Set NoCount on
    DECLARE @ContractID varchar(6)

    INSERT INTO Contract (Duration, NoOfHours) VALUES (@Duration, @NoOfHours)

    Select @ContractID=@@Identity

    INSERT INTO RoomBooking (RoomNo, Classroom, Hall, Date, StartTime, FinishTime, ContractID) VALUES (@RoomNo, @Classroom, @Hall, @Date, @StartTime, @FinishTime, @ContractID)
    END


    and to test it i tried to put in these values:
    exec contractRoomDetails 'cn14', '4months', '13', 'rm3', 'yes', 'no', '13/09/09', '2pm', '3pm'

    BUT the error message i keep getting is :

    Msg 8144, Level 16, State 2, Procedure contractRoomDetails, Line 0
    Procedure or function contractRoomDetails has too many arguments specified.
     
    sm2010, Apr 2, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TJS
    Replies:
    4
    Views:
    2,139
  2. nicholas

    insert stored procedure

    nicholas, Nov 17, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    536
    nicholas
    Nov 17, 2004
  3. EmJayEm
    Replies:
    4
    Views:
    4,185
    EmJayEm
    Jan 11, 2005
  4. Mike P
    Replies:
    0
    Views:
    3,381
    Mike P
    Jun 19, 2006
  5. Bill Kellaway

    ASP / Stored Procedure SQL Insert Help

    Bill Kellaway, Oct 10, 2003, in forum: ASP General
    Replies:
    7
    Views:
    246
    Bill Kellaway
    Oct 12, 2003
Loading...

Share This Page