Solved

create temp table with select statement

Posted on 2009-04-01
4
472 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
  • 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
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.

770 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