Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 893363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:12:31+00:00 2026-05-15T14:12:31+00:00

I need to provide 4 MySQL stored procedures for each table in a database.

  • 0

I need to provide 4 MySQL stored procedures for each table in a database. They are for get, update, insert and delete.

“Get”, “delete” and “insert” are straightforward. The problem is “update”, because I don’t know which parameters will be set and which ones not. Some parameters could be set to NULL, and other simply won’t change so they won’t be provided.

As I’m already working with XML, after several search in Google I’ve found that is possible to use a function called UpdateXML, but the examples are too complex and some articles are from 2007. So I don’t know if there is a better technique at this moment or something easier.

Any comment, documentation, link, article or whatever of something that you’ve used and you’re happy with, will be well appreciated 😀

Cheers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T14:12:32+00:00Added an answer on May 15, 2026 at 2:12 pm

    Usually when you have data from a row in your database in the front-end, you should have all of the values that you might use to update that row in the database. You should pass all of those values into your update, regardless of whether or not they have actually changed. Otherwise, your database doesn’t really know whether it’s getting a NULL value for a column because that’s what it’s supposed to be or because you just didn’t pass the real value along.

    If you are going to have areas of the application where you don’t need certain columns from a table, then it’s possible to set up additional stored procedures that do not use those columns. It’s often easier though to just retrieve all of the columns from the database when you fill your front-end object. The overhead of the extra columns is usually minimal and worth the saved maintenance of multiple update stored procedures.

    Here’s an example. It’s MS SQL Server syntax, so you may have to alter it slightly, but hopefully it illustrates the idea:

    CREATE PROCEDURE Update_My_Table
        @my_table_id    INT,
        @name           VARCHAR(40),
        @description    VARCHAR(500),
        @some_other_col INT
    AS
    BEGIN
        UPDATE
            My_Table
        SET
            name           = @name,
            description    = @description,
            some_other_col = @some_other_col
        WHERE
            my_table_id = @my_table_id
    END
    

    CREATE PROCEDURE Update_My_Table_Limited
        @my_table_id    INT,
        @name           VARCHAR(40),
        @description    VARCHAR(500)
    AS
    BEGIN
        UPDATE
            My_Table
        SET
            name           = @name,
            description    = @description
        WHERE
            my_table_id = @my_table_id
    END
    

    As you can see, just eliminate those columns that you’re not updating from the UPDATE statement. Just don’t go overboard and try to have a stored procedure for every possible combination of columns that you might want to update. It’s much easier to just get the extra columns from the DB when you select from the table in the first place. You’ll end up passing the same value back and your server will wind up updating the column with the same exact value, but that’s not a big deal. You can code your front end to make sure that at least one column has changed before it will actually try to update anything in the database.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to provide a window on an ASP.NET MVC web page where registered
I need to provide email sending and receiving capabilities within my java web-application. Think
I am starting research on a project that will need to provide ACID semantics
I need to implement an OpenID Provider in .Net and wondered....Is there's any OpenSource
Do you need to use some kind of provider? Can you setup your own
I need to create a custom membership user and provider for an ASP.NET mvc
I'm in need of a functional OleDB data provider for PostgreSQL. It should be
Need a function that takes a character as a parameter and returns true if
Need a way to allow sorting except for last item with in a list.
Need to an expression that returns only things with an I followed by either

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.