Re: Complex String for Insert.

From: Slarti <1012-873_at_gmx.de>
Date: 9 Jan 2002 06:12:28 -0800
Message-ID: <ccb8e3b6.0201090612.56b92aa9_at_posting.google.com>


torontodss_at_hotmail.com (Digiital) wrote in message news:<c874dd0a.0201080633.39dda880_at_posting.google.com>...
> I'm trying to insert the following 'complex' string into a table:
>
> datawindow.detail.height=679 #nxtmd# text_triggers_list.text=''
> #nxtmd# text_actions_list.text='' #nxtmd#
>
> With the following.
>
> INSERT INTO obj_syntax VALUES (34453,
> 1,
> 'datawindow.detail.height=679 #nxtmd# text_triggers_list.text=''
> #nxtmd# text_actions_list.text='' #nxtmd#',
> 'oper');
>
> Of course this produces a few errors. I CAN get it to work with the
> following.
>
> INSERT INTO obj_syntax VALUES (34453,
> 1,
> 'datawindow.detail.height=679 #nxtmd# text_triggers_list.text=''''
> #nxtmd# text_actions_list.text='''' #nxtmd#',
> 'oper');
>
>
> But that needs some manual changes.
> One of the other inserts I have to deal with is as followings, and
> again I have to manually add the extra quote.
>
> 13 nofparallel_t.height='68' nofparallel_t.text=''Number of Parallel
> processes:'' nofparallel_t.width='699' nofparallel_t.x='41'
> nofparallel_t.y='556'
>
> How would I go about inserting the whole string into ONE field.
>
> Thanks Folks.

Hi there,

How about that?

INSERT INTO obj_syntax VALUES (34453, 1, REPLACE('datawindow.detail.height=679 #nxtmd# text_triggers_list.text='' #nxtmd# text_actions_list.text='' #nxtmd#','''',''''''), 'oper');

REPLACE(string,'''','''''') will lead: "'" -> "''" (for any single quote BETWEEN the outer quotes), so if you have ".text=''" it will result in ".text=''''" during insertion. What you do ist to quote quotes and to display one qoute "'" in the database column you need four quotes "''''" to generate - sounds crazy.

I just tried it and worked well. Here the result of my insert:

datawindow.detail.height=679 #nxtmd# text_triggers_list.text='' #nxtmd# text_actions_list.text='' #nxtmd#

I think, that's what you're looking for. Received on Wed Jan 09 2002 - 15:12:28 CET

Original text of this message