SQLTeam.com | Weblogs | Forums

How to add value from table to empty string and parse string

Good morning,
I would like to seek your help and expertise regarding to how to add values from a table to an empty string , and to parse the empty string looking for a particular string value.

I have a table such as Table Names contain columns last_name, and address.

I would like to add every address values in Table Names that have last names is "John" in to a declare target string.

At the end, my target string containing values;for example, such as ("1 Main String, GA 30033", "2 North Avenue, Hapeville 30324", "@4 North Druid Hill, Atlanta 30129").

I then plan to parse the values in my target string , and then add it each of the value
to a address tables .

I would like to seek your help if you can show me some sample code on how to achieve the above tasks.

Many Thanks for all of the help.
Du

can you at minimum please provide sample source table with columns and the target table with columns. but for starters I dont think there is any need to do all of the intermediate stuff you describe. if I understand correctly you can do it in batch

select address
  into addresses
  from tableSource
where last_name like '%john%'