Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

REPLACE function with

Hi

I am importing data from one database structure to our sql db. However in
the LastName field, a high number of values contain an " ' " i.e. D'Arcy.

However when attempting to use the REPLACE function, it doesn't like the
' character, and neither does any other sql statement. The closest i've got
is selecting the offending records:

SELECT [Export Patient Data].XID, [Export Patient Data].FirstName, [Export
Patient Data].LastName
FROM [Export Patient Data]
WHERE ([Export Patient Data].LastName) Like "%'%";

Does anyone have any ideas?

Thanks
Jonas
[655 byte] By [jonas] at [2007-11-9 21:10:55]
# 1 Re: REPLACE function with
please do not double post - see my response in
database.sqlserver.general

"jonas" <jpshelley@btinternet.com> wrote in message
news:3df731ce$1@tnews.web.dev-archive.com...
>
> Hi
>
> I am importing data from one database structure to our sql db. However in
> the LastName field, a high number of values contain an " ' " i.e. D'Arcy.
>
>
> However when attempting to use the REPLACE function, it doesn't like the
> ' character, and neither does any other sql statement. The closest i've
got
> is selecting the offending records:
>
> SELECT [Export Patient Data].XID, [Export Patient Data].FirstName, [Export
> Patient Data].LastName
> FROM [Export Patient Data]
> WHERE ([Export Patient Data].LastName) Like "%'%";
>
> Does anyone have any ideas?
>
> Thanks
> Jonas
David Satz at 2007-11-11 23:52:08 >