Solved

How to create a temp table.

Posted on 2006-11-23
5
306 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
[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
5 Comments
 
LVL 43

Accepted Solution

by:
Eugene Z 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

632 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