RE: proc's result set to a temporary table.

RE: proc's result set to a temporary table.

 

  


> THAT requires the user/executor of the SP to have create table
> privileges(or
> dbo) if selecting into a non temp table(real tablename). Not allowed in
> most production environments.

??

OK - and THAT does not require any of the above if the process is selecting into a temp table, which would be the appropriate type of table to use if, as Aaron stated, he is looking to drop the table & re-create it each time he is generating new results.

Although I might be mistaken about this, I think the principal point of Aaron's question had to do with checking on the existence of a temporary table, which is why I provided that logic in a solution that overcame the limitation of no Boolean optimizations in tsql, and the error generated when using the "exists" keyword against a non-existent object.

Hope that helps,

Juan Cristián

MS Sql Server LazyDBA home page