Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Replace function

    Please help,
    I want to replace a string within field in a table with a nother string.
    I am using the replace function but I am doing something wrong.
    my code is:
    UPDATE authors SET au_lname = Replace(au_lname,'cheryl','frannk')
    What am I doing wrong?
    Regards
    Lamine


    Lamine Darbouche Guest

  2. Similar Questions and Discussions

    1. Trouble using Replace() function in CFN file
      I don't do much scripting in coldfusion besides some of the very basics for trasfering info from the database, so I'm not sure how to write this.......
    2. Problem with VB replace function for CRLF...I think
      I'm not sure if this is the best place for this post, sorry if it is not... Here is what I am doing: I have created a small kbase (SQL db)...
    3. Search & Replace Function?
      I have some textfield that users will enter data into on my web site and then I'll use php and write it to mysql - for security purposes, is there...
    4. Using Replace function to remove two different characters
      I'm using replace function to strip 0s from a particular string: <%=replace(rs1("racelength"),"0","''"%> but I need to also strip empty spaces...
    5. Text Replace function
      Hi - I'm using the replace function to hilite search words in text which is returned. However, as the text which is being searched also includes...
  3. #2

    Default Re: Replace function


    "Lamine Darbouche" <lamine_d@mpt-ltd.com> wrote in message
    news:eMnLwKoVDHA.2316@TK2MSFTNGP09.phx.gbl...
    > What am I doing wrong?
    > Regards
    > Lamine

    Try this ...

    UPDATE authors SET au_lname = 'frannk' where au_lname = 'cheryl'




    Paul White Guest

  4. #3

    Default Re: Replace function

    Lamine Darbouche wrote:
    > Please help,
    > I want to replace a string within field in a table with a nother
    > string. I am using the replace function but I am doing something
    > wrong.
    > my code is:
    > UPDATE authors SET au_lname = Replace(au_lname,'cheryl','frannk')
    > What am I doing wrong?
    > Regards
    > Lamine
    What database?
    Why do you think you are doing something wrong?

    Bob Barrows


    Bob Barrows Guest

  5. #4

    Default Re: Replace function

    > UPDATE authors SET au_lname = Replace(au_lname,'cheryl','frannk')
    > What am I doing wrong?
    Not sure. What is the problem? Are you getting an error message? If so,
    what is it? If not, what is the symtpom? e.g. is the replace not happening
    at all, is it replacing all values, is it replacing 'cheryl' with 'frannk'
    when you meant to replace 'frannk' with 'cheryl'?

    That's perfectly valid syntax in SQL Server. Access, not sure.


    Aaron Bertrand - MVP Guest

  6. #5

    Default Re: Replace function

    Great guys,
    Many thanks to both of you.
    Patrice, the answer to your yes replace is also a sql function.
    It works fine now.
    Regards
    Lamine


    "Patrice FRITSCH" <patrice.fritsch@NOSPAM.com> wrote in message
    news:O428Z$oVDHA.2272@TK2MSFTNGP11.phx.gbl...
    > is replace a SQL functions ?
    > I know it as a VB function !
    > If you want to replace every record where au_lname is "cheryl" by "frank",
    > then Pauls solution will word.
    > But not if "cheryl" is part of the field value.
    >
    >
    > "Lamine Darbouche" <lamine_d@mpt-ltd.com> a écrit dans le message de news:
    > [email]eMnLwKoVDHA.2316@TK2MSFTNGP09.phx.gbl[/email]...
    > > Please help,
    > > I want to replace a string within field in a table with a nother string.
    > > I am using the replace function but I am doing something wrong.
    > > my code is:
    > > UPDATE authors SET au_lname = Replace(au_lname,'cheryl','frannk')
    > > What am I doing wrong?
    > > Regards
    > > Lamine
    > >
    > >
    >
    >

    Lamine Darbouche Guest

  7. #6

    Default replace Function

    It seems that the replace function only replaces the first occorence of the
    string you are replacing. for example if I have a string:
    var heros:string = "I love superheros";

    and i want to replace all of the spaces:
    heros = heros.replace(" ","");

    what i would end up with is this:
    Ilove superheros

    am i using this function wrong? or is it only supposed to do this? is there
    another way to format my string if this is not working?
    sorry for all of the questions, and thanks in advance.

    Cpt_America23 Guest

  8. #7

    Default Re: replace Function

    Huh? Actionscript doesn't even have a native replace function. Where did you
    find it? I use:

    function replace(sString:String, sFind:String, sReplace:String):String
    {
    return sString.split( sFind ).join( sReplace );
    }

    If this is Flex 2, you will have better luck over in the Labs area.

    Tracy

    ntsiii Guest

  9. #8

    Default Re: replace Function

    it is flex 2 thanks though.
    Cpt_America23 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