Solved

How to create a temp table.

Posted on 2006-11-23
5
299 Views
Last Modified: 2008-02-01
I tried

INSERT INTO #temptable
EXEC sp_Who2

but get error

Msg 208, Level 16, State 0, Line 1
Invalid object name '#temptable'.
0
Comment
Question by:turbot_yu
  • 3
5 Comments
 
LVL 42

Accepted Solution

by:
EugeneZ earned 450 total points
ID: 18005474
--try:
--drop table #temptable
create table #temptable
(
id  SMALLINT,
status  CHAR(30) ,
login  CHAR(128) ,
hostname CHAR(128),
blkby  CHAR(5) ,
dbname  CHAR(128) ,
command  CHAR(16) ,
cputime  INTEGER ,
diskiO  INTEGER ,
lastbatch  varchar(1000) ,
programname CHAR(128) ,
spid1  SMALLINT )



insert into #temptable
exec sp_who2

 select * from #temptable

0
 
LVL 17

Assisted Solution

by:HuyBD
HuyBD earned 50 total points
ID: 18005586
EXEC sp_Who2 INTO #temptable
0
 
LVL 17

Expert Comment

by:HuyBD
ID: 18005600
Sorry, I have wrong answer
0
 

Author Comment

by:turbot_yu
ID: 18005736
EXEC sp_Who2 INTO #tmptable

Msg 10054, Level 20, State 0, Line 0
A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)
0
 
LVL 17

Expert Comment

by:HuyBD
ID: 18005739
turbot_yu, thank for your point!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now