PDA

Click to See Complete Forum and Search --> : hi!


Lafor
Nov 7th, 2000, 12:46 PM
If one writes a stored procedure
1.) with a drop table statement

SQL SERVER will not let u create the stored proc
warning u that the particular table does not exist
if it is not there

So, you would need create some form of it

2) with a select into table statement
It will tell u that the table already exists (if it exists already)

Now, how does one create a stored proc with these
two above statements

drop table mytable

select * into mytable from oo

Thanks in advance!!

monte96
Nov 7th, 2000, 02:10 PM
Why would you do that?

Use temporary tables if you need to create and drop tables within a stored proc. They exist only in the server's memory and live only as long as the proc runs.

Lafor
Nov 7th, 2000, 04:01 PM
There are good reasons to do this kind of thing especially
when optimizing queries...

I solved the prob by splitting the stored proc in 2

Monte... Thanks for responding...

P.S Why 96 and not 2000??

monte96
Nov 7th, 2000, 08:42 PM
Better model years....

Bigley
Nov 8th, 2000, 07:09 AM
Maybe what you really needed to do here was 'Truncate' the table..........or else I missed the point