List:General Discussion« Previous MessageNext Message »
From:Partha Dutta Date:May 12 2005 2:57pm
Subject:RE: UPDATE Query
View as plain text  
If you are trying to set the first 6 characters of your column to '111111'
then you can't use SUBSTRING on the LHS, but only from the RHS:

UPDATE CSV_Upload_Data SET PRACT_ASCII =
	CONCAT(SUBSTRING(PRACT_ASCII, 1, 15), '111111',
	SUBSTRING(PRACT_ASCII, 22))
WHERE Insertion_ID = 190716;

--
Partha Dutta, Senior Consultant
MySQL Inc, NY, USA, www.mysql.com
 
Are you MySQL certified?  www.mysql.com/certification
 

> -----Original Message-----
> From: shaun thornburgh [mailto:shaunthornburgh@stripped]
> Sent: Thursday, May 12, 2005 9:47 AM
> To: mysql@stripped
> Subject: UPDATE Query
> 
> Hi,
> 
> I am getting an error on the following query and but can't understand why,
> the syntax looks fine to me!
> 
> mysql> UPDATE CSV_Upload_Data SET SUBSTRING(PRACT_ASCII, 16, 6) = '111111'
> WHERE Insertion_ID = 190716;
> ERROR 1064 (42000): You have an error in your SQL syntax; check the manual
> that corresponds to your MySQL server version for the right syntax to use
> near 'SUBSTRING(PRACT_ASCII, 16, 6) = '111111' WHERE Insertion_ID =
> 190716'
> at line 1
> mysql>
> 
> Any advice would be greatly appreciated.
> 
> 
> 
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1

Thread
UPDATE Queryshaun thornburgh12 May
  • RE: UPDATE QueryPartha Dutta12 May