Jump to content

Need help with update statement!


iPixel

Recommended Posts

Ok i need to do this for both MySQL & Oracle, but once i see how the mysql version works i can figure out the oracle way (hopefully).

 

I have 2 columns which contain numbers such as 2707, 23, 000289  etc...

as you can see they range from 2 to 6 characters, and i need them all to be 6 characters.

 

How could i write an update sql statement that would change all the #'s to 002707,000023,000289 etc...

 

Thanks!

Link to comment
Share on other sites

What's the data type definition for the column?

 

If it's a string type, you would pad the values with zero's. if it's a numeric type, you would redefine the column to have a specific size with zero fill. Or you could just handle the zero pad/fill when you retrieve the data in your query or when you display the data in your php code.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.