• You just need to create the temp table in the stored procedure and then use the output...into temp table. Like so:

    create table #TempTable (same strucutre as postcodes?)

    with cte as

    ( SELECT TOP 50 * FROM postcodes TABLESAMPLE (0.1 percent) WITH (ROWLOCK, UPDLOCK)

    where Streets is null ORDER BY newid())

    update cte SET streets = 'Picked up'

    output inserted.*

    into #tempTable

    I would also get in the habit of listing out your column names and using 2-part naming for your objects.



    Microsoft Certified Master - SQL Server 2008
    Follow me on twitter: @keith_tate

    Forum Etiquette: How to post data/code on a forum to get the best help[/url]