sql - How to cancat query results into a text variable? -


i know built-in functions performs it. learn sql , want understand how make without these functions. i.e. have next code:

declare @stmt varchar; select column_1 @stmt some_table; 

how can change code stores values in @stmt single string 'value 1, value2, value 3, ..., value n'?

if want concat different values of column_1, use this

select string_agg(column_1,',') @stmt some_table; 

Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -