How to get the word like......

  • Hi Guys,

    I declared one variable and assign the values like 'star, moon, sun, galaxy'

    The output should be 'star', 'moon', 'sun', 'galaxy'

    Thanks in Advance

     


    Kindest Regards,

    karthik

  • I suspect this is not what you want, but it does do what you asked...

    declare @x varchar(30)

    set @x = 'star, moon, sun, galaxy'

    select '''' + replace(@x, ', ', ''', ''') + ''''

     

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • Are you looking for some sort of split function to split a comma-delimited list?

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply