>>I need to insert values into a temporary table from an SQL call, but for some reason I just can't think of how to do it.
>>
>>If I declare a temp table called @OutputTable and put one integer field called IntKey in it, how do I fill it with the values from this query: SELECT DISTINCT BatchID FROM MyTable
>
>First, it's table variable not temp table. A temp table name starts with '#' and it's created not declared.
>Anyway, you can use the same INSERT INTO command as with a regular table
>
>INSERT INTO @OutputTable SELECT DISTINCT BatchID FROM MyTable
>
Thanks! I was almost there but had the syntax incorrect.