Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Selecting from Temporary Table Variable

Author  Topic 

Brittney10
Posting Yak Master

154 Posts

Posted - 2011-02-04 : 17:42:47
I'm trying to select columns from a temporary table and another actual table. Is this possible?

This doesn't work:


select @temp_table.column, actual_table.column
from temp_table
join actual_table on
actual_table.column = temp_table.column





tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-02-04 : 17:44:40
select t.column, a.column
from @temp_table t
join actual_table a
on a.column = t.column

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Brittney10
Posting Yak Master

154 Posts

Posted - 2011-02-04 : 17:48:51
Of course! Table aliases!!! Thanks!
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-02-04 : 17:49:29


Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -