473,395 Members | 1,460 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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
Jul 19 '05 #1
4 3994
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
Jul 19 '05 #2
Got it, thanks

"dlbjr" <do******@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

Jul 19 '05 #3
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.
Jul 19 '05 #4
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
www.dotnetbooks.com
"atse" <du******@yahoo.com> wrote in message
news:Bu*********************@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

Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jack Smith | last post by:
Hello, I am working on the following problem. I need a divide and conquer algorithm to solve the following problem. Any help is appreciated. I have a set of coordinates (x,y) and each...
3
by: Dan | last post by:
Hi, I want to get the height of an element and dividing by 2, but i don't know how. See the code: <DIV ID="myDiv" STYLE="position:absolute; height:200"> ....</div> <script> myObj =...
6
by: Nobody | last post by:
I have some code that I am trying to optimize for speed... trying to squeeze every last CPU cycle out... I remembered an old trick where dividing & multiplying can be sped up by using bitshifts...
5
by: per.nordlow | last post by:
Hey there! I want to multiply/divide (shift) a float with variable containing a power-of-two value: 2, 4, 8, 16, .... Is there such a function in the C standard library or the glibc library...
8
by: Kevin | last post by:
Dim X as int32 Dim Y as int64 X = Y / 1024 gives me the error: "Operator is not valid for type 'UInt64' and type 'Integer'." I'm new to VB.NET and this is one of the reasons why I've...
40
by: Spiros Bousbouras | last post by:
Do you have an example of an implementation where sizeof(short int) does not divide sizeof(int) or sizeof(int) does not divide sizeof(long int) or sizeof(long int) does not divide sizeof(long long...
1
by: Justin.Velazquez | last post by:
Hello everyone, I'm not really new to programming but my bitwise skills definately need work. I came across a problem I've been trying to figure out for fun. I'm trying to write a routine...
2
by: programmo | last post by:
I need to divide in two string an article, to split in more pages: I have this string: <hello word> <hello word2>
1
by: neehakale | last post by:
pls tel me... I have to store data to heap file from a simple file.my file contain numeric data and string data...i have to divide tha data into numric and string. i.e. my file...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.