Ask a Question related to ASP, Design and Development.

  1. #1

    Default divide a string

    Hi,
    I have a string:
    mystring="1234,5678,985,21544,55524,11264, ... ,"

    How can I divide this string into
    1234
    5678
    985
    ....
    11264
    ....

    And then delete records corresponding to these separated strings?

    delete from mytable where id = '1234'
    ....
    delete from mytable where id = '11264'
    ....

    Thanks for any help.

    Atse


    atse Guest

  2. Similar Questions and Discussions

    1. Convert String to Int then divide
      Here is my code: <cfdirectory directory = "f:\testbed\documents\" name = "myDirectory" sort = "name ASC, size DESC"> <!--- Output the contents...
    2. Divide 24h into parts
      Hello, I'm creating a small web application for my company, but I can't find a good and reliable algorithm to create a function which divides...
    3. Divide by Zero in RDE
      On Fri, Oct 10, 2003 at 01:15:13AM +0900, Johan Nilsson wrote: You mentioned a patch for another version. I have once upgraded RDE to a newer...
    4. divide
      Hello, I'm new in php and i've got allready a problem. I wanna divide 2 numbers and the result to be an integer separated by comma. For example:...
    5. Gap when using Divide
      Hello, I was trying Freehand MX and noticed that when using the Divide command, appears a small gap between the newly created shapes... Is there a...
  3. #2

    Default Re: divide a string

    mystring = "1234,5678,985,21544,55524,11264, ... ,"
    arrData = Split(mystring ,",")
    For intCount = 0 To UBound(arrData )
    Delete arrData (intCount )
    Next

    'This is not the most efficient way.


    -dlbjr

    Discerning resolutions for the alms


    dlbjr Guest

  4. #3

    Default Re: divide a string

    Got it, thanks

    "dlbjr" <dontknow@do.u> wrote in message
    news:BO1jb.136$Qy4.11340@typhoon01...
    > mystring = "1234,5678,985,21544,55524,11264, ... ,"
    > arrData = Split(mystring ,",")
    > For intCount = 0 To UBound(arrData )
    > Delete arrData (intCount )
    > Next
    >
    > 'This is not the most efficient way.
    >
    >
    > -dlbjr
    >
    > Discerning resolutions for the alms
    >
    >

    atse Guest

  5. #4

    Default Re: divide a string

    On Wed, 15 Oct 2003 01:34:25 GMT, "atse" <dunggaze@yahoo.com> wrote:
    >Hi,
    >I have a string:
    >mystring="1234,5678,985,21544,55524,11264, ... ,"
    >
    >How can I divide this string into
    >1234
    >5678
    >985
    >...
    >11264
    >...
    >
    >And then delete records corresponding to these separated strings?
    >
    >delete from mytable where id = '1234'
    >...
    >delete from mytable where id = '11264'
    >...
    >
    >Thanks for any help.
    >
    >Atse
    >
    If the id is a string, you will need to build a string of comma
    delimited single quoted values.

    Once you get the string, use the Split command to get an array of
    values.

    A(0) will = "1234"
    A(1) will = "5678"
    etc.

    From here, cycle through the array appending to a string
    t = t & "'" & a(x) & &"',"

    Now use an SQL state ment like
    "delete from mytable where id in (" & t & ")"

    However, if your id values are numeric, you are basically there. Use
    the same method generate the sql statement, substituting the original
    string for t.
    Dan Brussee Guest

  6. #5

    Default Re: divide a string

    How about using the string in the SQL statement

    DELETE FROM myTable WHERE ID IN(12,23,34,45)

    Simpler than deleting one record at a time.

    --
    Manohar Kamath
    Editor, .netBooks
    [url]www.dotnetbooks.com[/url]


    "atse" <dunggaze@yahoo.com> wrote in message
    news:Bu1jb.338155$Lnr1.40547@news01.bloor.is.net.c able.rogers.com...
    > Hi,
    > I have a string:
    > mystring="1234,5678,985,21544,55524,11264, ... ,"
    >
    > How can I divide this string into
    > 1234
    > 5678
    > 985
    > ...
    > 11264
    > ...
    >
    > And then delete records corresponding to these separated strings?
    >
    > delete from mytable where id = '1234'
    > ...
    > delete from mytable where id = '11264'
    > ...
    >
    > Thanks for any help.
    >
    > Atse
    >
    >

    Manohar Kamath [MVP] 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