How do I find out whether a table exists or not in SQL Server? What I want to do is if the table exists, then DROP it while a stored procedure is being executed.
if exists
(select TABLE_NAME from INFORMATION_SCHEMA.TABLES
where TABLE_NAME='Categories' and
TABLE_SCHEMA='dbo'
)
[DROP STATEMENTS HERE]
ELSE
[do other stuff]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.