Member of the LearnItFirst.com Video Training Network | LearnSqlServer.com | SQL SSIS Training | SQL Programming Tutorials |
LearnSqlServer.com Forums LearnSqlServer.com
Welcome Guest Search | New Posts | Members | Log In | Register

ifexists Options
duck4
Posted: Thursday, November 29, 2007 10:38:03 PM
Rank: Newbie

Joined: 11/26/2007
Posts: 4
Points: 12
in sql server 2000, what would the query to check if a table #TableX exist then drop it?.
Scott Whigham
Posted: Wednesday, December 05, 2007 6:57:09 AM


Rank: Super Mod

Joined: 3/20/2006
Posts: 345
Points: 748
Location: Dallas, TX
There are several options. I favor this one:

IF EXISTS (SELECT * FROM INFORMATION.SCHEMA WHERE TABLE_SCHEMA='dbo' AND TABLE_NAME='Employee')
DROP TABLE dbo.Employee
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
     
Don't Forget!
LearnItFirst.com
Don't Forget!
LearnExchange.com
 
Home | About Us | Support | Contact Us | Privacy | Site Map | Blogs Blogs Refer a Friend and Get a Free Subscription!
© Copyright 2004-2007 LearnItFirst.com LLC. All rights reserved. All trademarks remain the property of their respective owners.
This site is not affiliated in any way with the Microsoft Corporation.