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

android - ConstraintLayout: Realign baseline constraint in case if dependent view visibility was set to GONE -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

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