Need help writing an UPDATE Stored Procedure

  • Dear forum members,

    I was wondering if you could help me out. This should be an easy one.  I am making my first Update/edit asp.net page. And I need to make a stored procedure to do the UPDATE to the row in my table that I am editing.

    The columns in my Venues table are:

    Venue (The Key ID column)

    VenueName

    VenueCity

    VenueState

    VenueURL

    Ticketing

    I am getting the error: Error 156: Incorrect syntax near the keyword 'WHERE'.

    I appreciate the help.

    Thanks,

    Jeff

    Boise, ID

    CREATE PROCEDURE Item_Update_Venue

    (

       @VenueName varchar(50),

       @VenueCity varchar(50),

       @VenueState char(10),

       @VenueURL varchar(150),

       @Ticketing varchar(500)

     

    )

    AS

    UPDATE venues

    WHERE Venue = Venue

    (

       VenueName,

       VenueCity,

       VenueState,

       VenueURL,

       Ticketing

    )

    VALUES

    (

       @VenueName,

       @VenueCity,

       @VenueState,

       @VenueURL,

       @Ticketing

      

    &nbsp

    GO

  • Here's a rewrite of your proc.  The syntax was a bit off for an update statement and I'm supposing you'll also need to pass in the venue value to select the appropriate record to update.

    Give this a shot...

    CREATE PROCEDURE Item_Update_Venue

    (

       @Venue int,

       @VenueName varchar(50),

       @VenueCity varchar(50),

       @VenueState char(10),

       @VenueURL varchar(150),

       @Ticketing varchar(500)

     

    )

    AS

    UPDATE venues

    SET VenueName = @VenueName,

       VenueCity = @VenueCity,

       VenueState = @VenueState,

       VenueURL = @VenueURL,

       Ticketing = @Ticketing,

    WHERE Venue = @Venue

    GO

    Good luck!

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

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