Stored procedure to Update the table

  • Can anybody help in writing a stored procedure to Update a table with ID as primary key

    Thanks in advance

  • Hi, your question is not entirely clear. Are you simply trying to update a table? Are you trying to change the primary key of the table?

    Please elaborate.

    Regards, Jim C

  • raveen4u (2/23/2009)


    Can anybody help in writing a stored procedure to Update a table with ID as primary key

    Thanks in advance

    Yes, but you will need to provide much more information - at the very least, the DDL of the table and where the new values will come from.

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

  • Hey

    I could do that Thanks a lot for inquiring about my query. I'm sorry I didn't elaborate the issue.

    Anyways thanks

  • [font="Courier New"]CREATE PROCEDURE [proc_update_table] @key_value [int], @column_value [varchar](50)

    AS

    UPDATE table_name

    SET column_in_question = @column_value

    WHERE ID = @key_value[/font]

    job done...

Viewing 5 posts - 1 through 4 (of 4 total)

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