Accidently destroying data with an UPDATE
At times the syntax of MySQL can appear overly strict eg when you are hurriedly hand typing a query and it keeps throwing up a syntax error. At other times however MySQL will output no error when you might wish it would. An example of this might be string concatenation
If you forgot that you needed to use Concat for this
ie
update tbl_password set url=concat('http://',url) where url not like
'http://%' limit 1; ### CORRECT###
but instead wrote
update tbl_password set url=url+'http://' limit 1; ### INCORRECT ###
You would destroy the contents of the field URL
If you forgot that you needed to use Concat for this
ie
update tbl_password set url=concat('http://',url) where url not like
'http://%' limit 1; ### CORRECT###
but instead wrote
update tbl_password set url=url+'http://' limit 1; ### INCORRECT ###
You would destroy the contents of the field URL

0 Comments:
Post a Comment
<< Home