Inserting A Delimmited Values into multiple Columns in a table

  • hi To All.

    i would like to kindly ask if you have a sample code for my scenario below;

    Column 1 = ID

    Column 2 = Lastname

    Column 3 = Job Description

    and then i will declare a variable to be used in inserting the columns mentioned above

    declare @Value varchar(4000)

    set @value = 'IDValue,Lastnamevalue,JobDescriptionvalue'

    is it possible to save these values in a seperate column named ID,Lastname and Job Description? your assistance is very much appreciated.

    Best Regards

    N.O.E.L.

  • [font="Arial"]Hello,

    declare @columncombine

    select @columncombine = select id + ',' + lastname + ',' + jobDescription from table

    if the values are in a table with those column definitions and you want to concatenate the fields

    with column titles:

    select Id as 'Id', LastName as 'Last Name, JobDescription as 'Job Description,

    id + ',' + lastname + ',' + 'jobDescription' as 'Id, LastName, JobDescription

    from table

    I hope this helped.

    Regards,

    Terry

    [/font]

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

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