At 11:52 PM -0800 3/7/08, J. Todd Slack wrote:
>Hi All,
>
>I have a client that wants to insert data into a VarChar field that contains
>commas. These are property addresses.
>
>Example:
>2966 Moorpark Ave, San Jose, CA, 95128
>
>1 Infinite Loop, Cupertino, CA, 955555
>
>How can I allow this?
>
>Thanks!
>-Jason
I've never had to escape commas; only special characters, eg: '_%.
MySQL seems to ignore escaping if the following character is not
special, though:
mysql-5.0.15-log@localhost> create table test (t1 varchar(255));
Query OK, 0 rows affected (0.03 sec)
mysql-5.0.15-log@localhost> insert into test values ('qwert'),
('qwe,rt'),('qwe\,rt');
Query OK, 3 rows affected (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql-5.0.15-log@localhost> select * from test;
+--------+
| t1 |
+--------+
| qwert |
| qwe,rt |
| qwe,rt |
+--------+
3 rows in set (0.00 sec)
Are you getting an error when you insert a row? If so, what is the
error? Perhaps you are having a character set issue. This is what
mine looks like:
mysql-5.0.15-log@localhost> show variables like 'character\_set\_%';
+--------------------------+--------+
| Variable_name | Value |
+--------------------------+--------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
+--------------------------+--------+
6 rows in set (0.00 sec)
steve
--
+--------------- my people are the people of the dessert, ---------------+
| Steve Edberg http://pgfsun.ucdavis.edu/ |
| UC Davis Genome Center sbedberg@stripped |
| Bioinformatics programming/database/sysadmin (530)754-9127 |
+---------------- said t e lawrence, picking up his fork ----------------+