<p>I want to select about 4-5 rows from a table, then form a space separated string.</p>

<p>All of this is to be done in a stored procedure (SQL server 2005).</p>

<p>Is this possible?</p>

<p>I will then use this space-separated string and save it to another table.</p>

<p><b>Update</b></p>

<pre><code>SELECT *
FROM Users
WHERE userID &lt; 10
</code></pre>

<p>output:</p>

<pre><code>john
jake
blah
sam
</code></pre>

<p>So, put this in a space separated string:</p>

<p>'john jake blah sam'</p>

<p>and save that string to another row in a table.</p>

<p>All this has to be done in a stored procedure (if possible).</p>

I think something like this will work:
```
```
DECLARE @whatever varchar(max)  -- or varchar(1000) or whatever size
SET @whatever = ''

SELECT @whatever = @whatever + MyColumn + ' ' FROM MyTable
```
```