Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inserting values into a temporary table
Message
 
 
To
30/08/2007 11:36:05
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01251389
Message ID:
01251390
Views:
16
This message has been marked as the solution to the initial question of the thread.
>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 
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform