I am a novice in SQL and I am following a web tutorial. I encountered a piece of code where SELECT statement assigns a value to a variable. I suspect that such SELECT statements don't make a table as a result. E.g. when I want to mix the assignment with a column name as in:

```
DECLARE 
    @columns NVARCHAR(MAX) = '';

SELECT 
    @columns += QUOTENAME(category_name) + ',',
    category_name
FROM 
    production.categories
ORDER BY 
    category_name;

SET @columns = LEFT(@columns, LEN(@columns) - 1);

PRINT @columns;

```

I get the following error:

> 
> Msg 141, Level 15, State 1, Line 4  
> 
>  A SELECT statement that assigns a value to a variable must not be combined with data-retrieval operations.
> 
> 
> 

(Following this [course](http://www.sqlservertutorial.net/sql-server-basics/sql-server-pivot/) on Internet with [database](http://www.sqlservertutorial.net/wp-content/uploads/SQL-Server-Sample-Database.zip))

My question is if there exists another form of data manipulation (as an assignment) that in a SELECT statement don't produce a table (if my assumption is right).