how to split value form field and drill down list

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lonjovy
    New Member
    • Jul 2010
    • 1

    how to split value form field and drill down list

    So,please help me to split value from table like below

    field A has value below
    13974;14098;142 37;14269;14317; 14319;14392;143 93;13257;13983; 13820

    and i need to split and down value in row like below
    file B
    13974
    14098
    14237
    14269
    ....
    please help me to supports
    many thanks
  • viktorka
    New Member
    • Jun 2010
    • 26

    #2
    You may try to play around te code below, however, if you pass this string to SQL from VB, C++ or other, it could be easier to split it before passing it to SQL.

    declare @str as varchar(50)
    set @str = '13974;14098;14 237;14269;14317 ;14319;14392;14 393;13 257;13983;13820 '

    while charindex(';',@ str)>0 begin
    select left(@str, charindex(';',@ str)-1)
    set @str = right(@str,len( @str)-charindex(';',@ str))
    end

    Comment

    Working...