barry17
barry17

Reputation: 153

Taking a string and removing commas from it, vb6, SQL?

So I have a listview in my application. I let the user select multiple items from it, and save it in SQL-SERVER. If more than one items are selected, i save the values as string in this format 105, 106, 107. Now I need to Select these values and remove the commas from them, anyone have any ideas?

Upvotes: 0

Views: 422

Answers (2)

Fred
Fred

Reputation: 5808

Based on your question and the comment to the answer from Mat I would say forget removing the comma's and use Split

   Dim strArray() As String
   Dim intCnt As Integer


   strArray = Split(strYourCommaDelimitedData, ",")

   For intCnt = LBound(strArray) To UBound(strArray)
      'Trim(strArray(intCnt)) or CInt(Trim(strArray(intCnt)) 
      'will hold each value use it to select your item
   Next

Upvotes: 2

Mat Richardson
Mat Richardson

Reputation: 3606

In SQL SERVER you could use REPLACE:-

SELECT REPLACE(YourData,',','') from YourDataset

This would replace the comma as required.

Upvotes: 1

Related Questions