Stored procedure to create delimited string

  • Ive found this site quite useful in the past for problem solving but couldn't find anything to help me this time so decided to sign up!

    Not sure if you can help me or not....

    Im having trouble creating a stored procedure that can do the following:

    Select only A,B,C,D,E from TABLEA

    Foreach row{

    firstrow:

    Place all of these values into a single temp string (i.e: "A.value,B.value,C.value,etc...)

    each additional row:

    tempstring = tempstring + new string

    }

    So basically:

    1st row) temp = "A.value,B.value,C.value,"

    2nd row) temp = "A.value,B.value,C.value , A.value,B.value,C.value,"

    3rd row)temp = "A.value,B.value,C.value , A.value,B.value,C.value, A.value,B.value,C.value)

    And so on...

    Then RETURN the tempstring.

    *If anyone is interested, it will be to create a CSV file using only selected rows from the table(s)

  • I think this article[/url] might help.

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

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