fetch value from comma seperated string


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: fetch value from comma seperated string

  1. #1
    Join Date
    May 2005
    Posts
    12

    fetch value from comma seperated string

    Hi
    I have a variable myvar char(100).
    I have assign a value to it myvar='abc,bb,xft,gty'
    First I want to check how many , are there in this variable.
    second I want to get the value from this variable before each comma like:
    abc
    bb
    xft
    gty

    I am working on db2 databse.

    Regards
    Anshul

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    I know nothing about DB2, but here's how to do it in SQL Server: http://www.google.com/search?q=sql+c...rray+parameter . Perhaps the same methods will work in DB2?
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Apr 2004
    Posts
    5

    Arrow Fetch Values from Comma Deliminated String

    Here is how I do it.
    Dim aInfo As Array
    'set aInfo to variable returned from db2 then...
    aInfo = strData.Split(",")
    If aInfo.Length < 0 Then
    Throw New Exception("Missing data ")
    End If

    If IsNothing(aInfo(0).ToString.Trim) Then
    gECnbr = " "
    Else
    gECnbr = aInfo(0).ToString
    Me.txtReason.Text = "EC" & gECnbr.TrimEnd
    End If

    If IsNothing(aInfo(1).ToString.Trim) Then
    gECrev = " "
    Else
    gECrev = aInfo(1).ToString
    End If

    etc...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center