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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:48:43+00:00 2026-06-10T03:48:43+00:00

I am using MySql and came across a problem. I have a column name

  • 0

I am using MySql and came across a problem.

I have a column name price(Double) and i want to create a new column in the same table of datatype String and wants to copy the price into new column for all rows present in the table
with fixed length pattern.

example i want to do the following

  Price(double)      newcolumn(String)
     12                      00012
      1                      00001
      0                      00000

please help me to sort out this problem.

  • 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-10T03:48:45+00:00Added an answer on June 10, 2026 at 3:48 am

    Perhaps something like this could work:

    UPDATE YourTable SET newcolumn = LPAD(REPLACE(FORMAT(Price,0),',',''),5,'0')
    

    The FORMAT function converts the double into a string with 0 decimals and here is the api.
    The FORMAT introduces commas to separate thousands so we need to use REPLACE to get rid of those and here is the api.
    The LPAD function left pads with the '0' and here is the api

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

Sidebar

Related Questions

Using MySQL, I have a simple table that logs the IP Address that users
Using MySQL, I have three tables: projects : ID name 1 birthday party 2
I am using C++ and MySQL. I have data objects I want to persist
I am using mysql with php Yii framework.When doing data modelling I came accross
(Using MySQL and PHP) I have a search form that will allow my users
I'm trying to optimize SQL queries in Akonadi and came across the following problem
While I was converting my latin-1 mysql database into utf-8 i came across this
I am developing a personal PHP/MySQL app, and I came across this particular scenario
In a MySQL book I came across a part which was said: If you
I've just created my first mySQL table on my own (other than using Joomla,

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.