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 2000 Forums
 Transact-SQL (2000)
 Storing SP results into a table, but more!

Author  Topic 

MuadDBA

628 Posts

Posted - 2003-02-13 : 15:26:31
I need to store the results of a stored procedure into a table, but I need to store additional data at the same time.

For instance, I will be storing the results of xp_getfiledetails into a table, but it's pretty worthless unles sI also have the path and filename of the file in question.

I have tried various iterations of insert into to get this to work, but I can't seem to combine an insert into...exec with an insert into..select or even insert into...values.

Can someone help me?

I use SQL 7.0 SP3

Joe

pareshmotiwala
Constraint Violating Yak Guru

323 Posts

Posted - 2003-02-13 : 15:35:19
One thing you could obviously try doing is to create temporarty table1 with one set of data,
a temp table2 with another set of data and then "insert into"....


Go to Top of Page

MuadDBA

628 Posts

Posted - 2003-02-13 : 15:37:08
The obvious way to link these two tables would be?

I am getting file details for over 400 files, I need to be able to insert the path of each file along with its details so I can distinguish which details go with which file....

Go to Top of Page

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2003-02-13 : 17:13:02
How about

SELECT A.* INTO #Temp
FROM OPENROWSET('SQLOLEDB', 'YourServer'; 'YourLogin'; 'YourPassword','exec Database.owner.sp_who') as A

Another way would be to define your temp table
fields and then use
INSERT INTO #temp
EXEC MyStoredProc

Another way would be to rewrite sproc into udf the benefit to this is that you can return a table variable and use it in unions or joins and still have the ability to pass parameters.



Edited by - ValterBorges on 02/13/2003 18:05:49
Go to Top of Page
   

- Advertisement -