Uploading data to MS SQL Server - problem with quote character

Sam,

I need to upload data coming from Oracle database to
an MS SQL Server. But I'm having problems inserting
if data contains a quote (') character.

    On most all modern databases, a single quote must be quoted with
another single quote. For example, to update a value to the string "I
don't know":

UPDATE mytable SET mystring = 'I don''t know.'

    I hope this helps.

    - Warren Brown

You'll also want to escape the usual SQL special characters, namely
backslashes etc if this stuff occurs in your data. It's an SQL thing, not a
Ruby thing though. :slight_smile:

···

On Wednesday 04 January 2006 19:41, Warren Brown wrote:

Sam,

> I need to upload data coming from Oracle database to
> an MS SQL Server. But I'm having problems inserting
> if data contains a quote (') character.

    On most all modern databases, a single quote must be quoted with
another single quote. For example, to update a value to the string "I
don't know":

UPDATE mytable SET mystring = 'I don''t know.'

    I hope this helps.

    - Warren Brown