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 7709139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:47:24+00:00 2026-06-01T00:47:24+00:00

I am working on a legacy system that generates confirmation numbers based on the

  • 0

I am working on a legacy system that generates confirmation numbers based on the ID of their order record in the database. It’s just a bunch of zeros append to the front of the row ID which is created automatically using auto increment. Currently the system is inserting the order into the database and then immediately doing an update to add the confirmation number (after getting the insert ID programmatically).

I’d like to reduce this second step if at all possible by adding the confirmation number when the order is placed. However, I am unaware of how this can be done, or if it can be done, via SQL. Is this possible? If so, how? I’ve Googled this but I just get results telling me how to get the last insert ID after the query has already run.

  • 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-06-01T00:47:25+00:00Added an answer on June 1, 2026 at 12:47 am

    You can write a trigger that is execute where order is inserted.

    Sample:

    CREATE TRIGGER order_zeros BEFORE INSERT ON orders
    for each row
    begin
      SET NEW.confirmation = LPAD( NEW.id, 8, '0' );
    end;
    

    Disclaimer: this code is not tested, only to explain solution.

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

Sidebar

Related Questions

I'm working on a legacy system that has uses stored procs, business objects and
I have a really ugly legacy database system that I need to integrate with.
I am working with a legacy system that stores its data in individual files
I'm working on a legacy COM C++ project that makes use of system hungarian
We are working with a legacy database that uses SQL server uniqueidentifier columns for
I am working with legacy code of a template that is based on template<class
I'm working with a legacy system that I'm experimenting with adding NHibernate to. I
A legacy system that I am working on has a piece of xml which
I'm working on a legacy system that has the following timeout values in web.config.
I'm currently working on a legacy eCommerce system front-end that has alot of duplicate

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.