Solved

How to create a temp table.

Posted on 2006-11-23
5
302 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
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
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

808 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