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
 SQL Server Development (2000)
 If EXISTS drop table

Author  Topic 

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2004-02-04 : 14:40:09
Ok Probably a simple answer but I never use drop table.

And have been at it all night.

What the heck did I do to this part of my SP.


If EXISTS Table TempStockSales
Begin
Drop Table TempStockSales
End


Jim
Users <> Logic

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2004-02-04 : 14:43:50
[code]IF EXISTS (select * from information_schema.tables where table_name = 'TempStockSales')
DROP TABLE TempStockSales[/code]

EDIT: Oops!! - The table was called TempStockSales
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-02-04 : 14:44:10
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TempStockSales]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[TempStockSales]
GO


Tara
Go to Top of Page

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2004-02-04 : 14:49:10
Wow was I off.


Thanks for the Brain jarr.

Tara I am going to have to Put You on the Pay roll.


Thanks

Jim
Users <> Logic
Go to Top of Page
   

- Advertisement -