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)
 How to create a temp table?

Author  Topic 

jollyguy77
Starting Member

4 Posts

Posted - 2009-07-13 : 13:10:34
Hi,

I am new to SQL. I have a stored procedure where i call another stored procedure which returns a Table. From that table i will again check for conditions and then return the resultset. I know that by creating a temp table and then work on that table. What i would i like to know is the following

1) I will not know how many columns will get returned from the 2nd SP. So how to create a temp table for that scenario?
2) Can i use Select * into table query and if so how to do it?

Please it's quite important.

Thanks,
Raja

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-07-13 : 14:26:29
yup. you can. see below

http://sqlblogcasts.com/blogs/madhivanan/archive/2007/11/26/select-columns-from-exec-procedure-name-is-this-possible.aspx
Go to Top of Page

djorre
Yak Posting Veteran

94 Posts

Posted - 2009-07-15 : 09:28:31
If you do not know the column names of the resultset than it will be difficult to put all the results in a temp table because a table needs to have predefined column names. And how are you going to check that for conditions if you don't know the column names?

Why is it you do not know the columns of the resultset?

I should never use 'select * from' anyway. Though i'm not an expert.
Go to Top of Page
   

- Advertisement -