On Wed, 15 Oct 2003 01:34:25 GMT, "atse" <du******@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.