Update portion of a string column

Ask a Question related to IBM DB2, Design and Development.

  1. #1

    Default Update portion of a string column


    Hi,

    I have a column that has a string field, and I only wanna update the 3rd
    character in the string. e.g. change 'StRing' to 'String'. Is this
    possible with raw sql?
    I can do it with a simple php script, however the raw sql solution would
    be prefered.

    regards,
    Yves Glodt



    ----------------------------------------------------------------
    ELECTRO SECURITY
    Yves Glodt yves.glodt at electrosecurity.lu
    Support Informatique
    73, rue de Strasbourg Tél: ++352 406 406-1
    L-2561 Luxembourg Fax: ++352 406 407
    Web: [url]http://www.electrosecurity.lu[/url]
    ----------------------------------------------------------------

    Yves Glodt Guest

  2. Similar Questions and Discussions

    1. Reference Column Name by string...
      If you read half way through my question and think to yourself, "Huh?" you will know exactly how I feel right now. I am dynamically creating a...
    2. Multi-parameter query string in hyperlink column...
      I have found some postings on multi-parameter hyperlinks. But none of them involve calling a javascript function. I have almost got the NavigateUrl...
    3. How to sort a String column as Numeric?
      I have a datagrid (dgResults) that I am populating from a SQL stored procedure. After I fill my dataset (ds), I cache the dataset this way:...
    4. String question: Returning portion of string with words surrounding highlighted search term?
      I'm looking to find or create an ASP script that will take a string, examine it for a search term, and if it finds the search term in the string,...
    5. Hyperlink Template Column w Query String
      Hi, I need to bind data to a datagrid and have a custom hyperlink column that has multiple elements in the querystring: ...
  3. #2

    Default Re: Update portion of a string column

    Anything similar to
    values(
    concat ( (left('abcdef', 2)), (concat( ('z'),
    (right('abcdef', length('abcdef')-3)) ) ) )
    )

    PM


    PM \(pm3iinc-nospam\) Guest

  4. #3

    Default Re: Update portion of a string column

    Yves Glodt <yves.glodt@SPAMTRAPelectrosecurity.lu> wrote in message news:<3f616642$1_1@news.vo.lu>...
    > Hi,
    >
    > I have a column that has a string field, and I only wanna update the 3rd
    > character in the string. e.g. change 'StRing' to 'String'. Is this
    > possible with raw sql?
    > I can do it with a simple php script, however the raw sql solution would
    > be prefered.
    >
    > regards,
    > Yves Glodt
    >
    how about

    update t set c = substr(c,1,2) || 'r' || substr(c,4)


    /Lennart

    >
    >
    > ----------------------------------------------------------------
    > ELECTRO SECURITY
    > Yves Glodt yves.glodt at electrosecurity.lu
    > Support Informatique
    > 73, rue de Strasbourg Tél: ++352 406 406-1
    > L-2561 Luxembourg Fax: ++352 406 407
    > Web: [url]http://www.electrosecurity.lu[/url]
    > ----------------------------------------------------------------
    Lennart Jonsson Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139