I would like to loop thru a selection set and create a single string from all of the records to be returned as an OUTPUT var. The first step is to concatenate all of the fields of each record into a string. This can be done by individually stating each field in the SELECT statement and using CAST(), but SP would have to be edited whenever column names change or columns are added/dropped. So I would like to refer to the columns by their ordinal number and then extract their value into the string. I have found ways to get the column *name* via system table queries and an ordinal value , but not how to get the column *value* based on an ordinal value.
Is there any other way to do this without resorting to dynamic SQL statements?
Thanks for your help.
Is there any other way to do this without resorting to dynamic SQL statements?
Thanks for your help.