> Yeah. I am moving data from mysql server to sql
> server.
> Because I have single quote in some strings, it
> generated errors when I ran mysqldump scripts in sql
> server to import data in.
> i.e. strings Here's, Martin's ,... caused trouble.
> Does that mean sql didn't recognize escaped single
> quote?
> Thanks,
> Monet
>
I *think* sql server escapes single quotes *only* when two appear together.
So two single quotes in a row equals one single quote. Brilliant, eh? ...To
be a fly on the wall when that decision was made. :-) I think that is
actually the ANSI SQL standard for escaping single quotes and not just an M$
thing. It works in MySQL too by the way. Try it:

INSERT INTO testing values('Here''s','Martin''s','mom''s');

same as

INSERT INTO testing values('Here\'s','Martin\'s','mom\'s');

I suppose you could try to open the dump file in an editor like vi or
notepad or some other editor that has a search and replace and replace \'
with '' and see what happens. vi: :%s/\\'/''/g

The alternative would be to use mysqdump with -T option and use the
options --fields-terminated-by=, --fields-enclosed-by=, --fields-optionally-
enclosed-by=, --fields-escaped-by=, and --lines-terminated-by= to make a csv
file. You can use BCP or MS DTS to load a csv into sql server tables. There
may be another sql server equivelant to LOAD DATA INFILE that can accept csv
or tsv. Who knows???

Good luck,

Jim Grill




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to