You can return table rows as single row using a COALESCE trick. This can be possible by appending each row value to a variable.
The SQL Coalesce are used to handle NULL values. During the expression evaluation process the NULL values are replaced with the user-defined value.
declare @ret varchar(4000) select @ret=coalesce(@ret+', ','') + l_name from accounts print(@ret)
Here in my SQL script, created a variable and append all row values in the column of l_name to sql vaiable @ret and then I print the result
Even though the script can return lengthy string, it may depends on the number of rows and the capacity of varchar variable declared.