Solved

create temp table with select statement

Posted on 2009-04-01
4
484 Views
Last Modified: 2013-12-07
Hi Expert,

Why it does'nt work

CREATE TABLE #temCity1 AS SELECT * into #temCity FROM tblCity

Thanks in advance
0
Comment
Question by:dshi15
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 31

Accepted Solution

by:
RiteshShah earned 400 total points
ID: 24040334
emps is original table and #t is temp

select * into #t from emps
 
select * from #t

Open in new window

0
 
LVL 31

Assisted Solution

by:RiteshShah
RiteshShah earned 400 total points
ID: 24040362
dont use CREATE table, don't need it, just use

SELECT * into #temCity FROM tblCity
0
 
LVL 39

Assisted Solution

by:BrandonGalderisi
BrandonGalderisi earned 100 total points
ID: 24040364
RiteshShah's method is correct.

Here's a post we have over at http://SQLServerNation.com explaining how to use select/into.

http://sqlservernation.com/blogs/tipweek/archive/2009/02/23/select-into.aspx
0
 
LVL 31

Expert Comment

by:RiteshShah
ID: 24040381
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question