Solved

How to create a temp table.

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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how the fundamental information of how to create a table.

710 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