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)
 Checking Existence of Database object

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-12-02 : 08:27:55
a writes "hi
i wanted to create one table through one procedure.but if that table is already present in the database then first i want to drop it and then to create it.
My question is
how do i check whether the particular table already present or not?"

dsdeming

479 Posts

Posted - 2004-12-02 : 08:30:00
IF OBJECT_ID( 'mytable' ) IS NOT NULL
drop table mytable

Dennis
Go to Top of Page

Amethystium
Aged Yak Warrior

701 Posts

Posted - 2004-12-02 : 10:39:57
I think you're better off using the information_schema view already provided. I only use the object_id function if I want to check for the existence of a temp table.


------------->>> BREAKING NEWS!!! <<<-------------
Saddam Hussien has weapons of mass destrcution
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-12-02 : 12:30:00
why?

Go with the flow & have fun! Else fight the flow
Go to Top of Page

Amethystium
Aged Yak Warrior

701 Posts

Posted - 2004-12-02 : 17:59:53
Safer apparently... don't ask me awkward questions please


------------->>> BREAKING NEWS!!! <<<-------------
Saddam Hussien has weapons of mass destrcution
Go to Top of Page
   

- Advertisement -