GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   MySql query help needed asap. (https://gfy.com/showthread.php?t=848950)

Pics Traffic 08-19-2008 09:20 AM

MySql query help needed asap.
 
I have a field in db that is 10 char long and its random characters.
I need to either truncate every one of them to 9 chars or replace last characters with "xx"

Is there way to do it with query that will update all rows of data?

sortie 08-19-2008 09:22 AM

MySQHell.

woj 08-19-2008 09:35 AM

probably just change the field from 10 to 9 characters... but make a backup of the table in case something goes wrong...

tical 08-19-2008 10:02 AM

mysql will prob error if you try to change the field to 9 chrs... back up before trying this, but it should work (and do it to the whole table)


update table set field = substring(field, 1, 9)


All times are GMT -7. The time now is 11:41 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123