Professional Web Applications Themes

Update portion of a string column - IBM DB2

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] ----------------------------------------------------------------...

  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. #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

  3. #3

    Default Re: Update portion of a string column

    Yves Glodt <yves.glodtSPAMTRAPelectrosecurity.lu> wrote in message news:<3f616642$1_1news.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

Similar Threads

  1. Reference Column Name by string...
    By dobaldwin in forum Coldfusion - Advanced Techniques
    Replies: 1
    Last Post: July 30th, 11:34 PM
  2. Multi-parameter query string in hyperlink column...
    By Steve Kallal in forum ASP.NET Data Grid Control
    Replies: 3
    Last Post: April 29th, 08:48 AM
  3. How to sort a String column as Numeric?
    By Todd in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: November 25th, 02:21 PM
  4. Replies: 4
    Last Post: August 14th, 06:04 AM
  5. Hyperlink Template Column w Query String
    By Carl Howarth in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: July 24th, 09:57 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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