Re: Trying to update data in a table - getting an error
Hi, substr() doesn't exist in MySQL. Use substring(). UPDATE DocComms SET ItemHSCode = concat(substring( ItemHSCode, 1, 4 ), substring( ItemHSCode, 6, 2 ), substring( ItemHSCode, 9, 2 )) On Tue, 2003-01-21 at 15:34, Don wrote: > Hi, > RESENT DFUE TO TYPO > > I want to change a field in a table. Currently the data is in theformat --> > 4818.50.00 > I want to remove the decimal points so that it is like --> 48185000 > I tried the sql code below but am getting a syntax error. Can someone > please point out the error of my ways? > > UPDATE DocComms SET ItemHSCode = concat(substr( ItemHSCode, 1, 4 ), > substr( ItemHSCode, 6, 2 ), substr( ItemHSCode, 9, 2 )) > > Thanks, > Don -- Diana Soares - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Trying to update data in a table - getting an error
* Don > I want to change a field in a table. Currently the data is in > theformat --> > 4818.50.00 > I want to remove the decimal points so that it is like --> 48185000 > I tried the sql code below but am getting a syntax error. Can someone > please point out the error of my ways? > > UPDATE DocComms SET ItemHSCode = concat(substr( ItemHSCode, 1, 4 ), > substr( ItemHSCode, 6, 2 ), substr( ItemHSCode, 9, 2 )) The name of the substring function in mysql is SUBSTRING() or MID(), not SUBSTR(). It would be easier to use the REPLACE() function: UPDATE DocComms SET ItemHSCode = REPLACE(ItemHSCode,'.','') http://www.mysql.com/doc/en/String_functions.html > HTH, -- Roger - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Trying to update data in a table - getting an error
Hi, RESENT DFUE TO TYPO I want to change a field in a table. Currently the data is in theformat --> 4818.50.00 I want to remove the decimal points so that it is like --> 48185000 I tried the sql code below but am getting a syntax error. Can someone please point out the error of my ways? UPDATE DocComms SET ItemHSCode = concat(substr( ItemHSCode, 1, 4 ), substr( ItemHSCode, 6, 2 ), substr( ItemHSCode, 9, 2 )) Thanks, Don --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Trying to update data in a table - getting an error
Hi, I want to change a field in a table. Currently the data is in the format --> 4818.50.00 I want to remove the decimal points so that it is like --> 4818.50.00 I tried the sql code below but am getting a syntax error. Can someone please point out the error of my ways? UPDATE DocComms SET ItemHSCode = concat(substr( ItemHSCode, 1, 4 ), substr( ItemHSCode, 6, 2 ), substr( ItemHSCode, 9, 2 )) Thanks, Don --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php