Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 INSERT INTO use SP

Author  Topic 

inbs
Aged Yak Warrior

860 Posts

Posted - 2009-10-01 : 04:50:53
hi

i want to insert table result from procedure this is my query:

CREATE TABLE #drives (ServerName varchar(15),
drive char(1) PRIMARY KEY,
FreeSpace int NULL,
FreePercent int NULL,
TotalSize int NULL,
FreespaceTimestamp DATETIME NULL)

INSERT INTO #drives EXEC dbo.sp_diskspace

if i run EXEC dbo.sp_diskspace i get

ServerName drive Total(MB) Free(MB)	Free(%)	FreespaceTimestamp
SER01 C 90000 35000 42 2009-10-01

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-10-01 : 04:53:38
quote:
Originally posted by inbs

hi

i want to insert table result from procedure this is my query:

CREATE TABLE #drives (ServerName varchar(15),
drive char(1) PRIMARY KEY,
FreeSpace int NULL,
FreePercent int NULL,
TotalSize int NULL,
FreespaceTimestamp DATETIME NULL)

INSERT INTO #drives EXEC dbo.sp_diskspace

if i run EXEC dbo.sp_diskspace i get

ServerName drive Total(MB) Free(MB)	Free(%)	FreespaceTimestamp
SER01 C 90000 35000 42 2009-10-01



Did you get any error?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-10-01 : 04:54:42
quote:
Originally posted by inbs

hi

i want to insert table result from procedure this is my query:

CREATE TABLE #drives (ServerName varchar(15),
drive char(1) PRIMARY KEY,
FreeSpace int NULL,
FreePercent int NULL,
TotalSize int NULL,
FreespaceTimestamp DATETIME NULL)

INSERT INTO #drives EXEC dbo.sp_diskspace

if i run EXEC dbo.sp_diskspace i get

ServerName drive Total(MB) Free(MB)	Free(%)	FreespaceTimestamp
SER01 C 90000 35000 42 2009-10-01



it looks fine. did you get any error
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-10-01 : 04:54:59
Go to Top of Page

cipriani1984
Constraint Violating Yak Guru

304 Posts

Posted - 2009-10-01 : 05:08:41
isnt #tablename a temporary table? will that get stored?

quote:
Originally posted by visakh16

quote:
Originally posted by inbs

hi

i want to insert table result from procedure this is my query:

CREATE TABLE #drives (ServerName varchar(15),
drive char(1) PRIMARY KEY,
FreeSpace int NULL,
FreePercent int NULL,
TotalSize int NULL,
FreespaceTimestamp DATETIME NULL)

INSERT INTO #drives EXEC dbo.sp_diskspace

if i run EXEC dbo.sp_diskspace i get

ServerName drive Total(MB) Free(MB)	Free(%)	FreespaceTimestamp
SER01 C 90000 35000 42 2009-10-01



it looks fine. did you get any error

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-10-01 : 05:12:13
yup it will. it will have its scope until the current connection terminates
Go to Top of Page
   

- Advertisement -