It
is very common to deal with situation
where you have thousands of tables and you would like to know that whether a
particular table exist or not in your database.T-SQL command that will
determine if a table exist or not.
Please
change database name and table name accordingly.
**********************************************
IF EXISTS
(SELECT *
FROM YourDB.INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = 'dbo'
AND TABLE_NAME = 'YourTable'
AND TABLE_TYPE = 'BASE TABLE'
)
PRINT ' Table Exist'
Else
PRINT ' Table Does not Exist'
GO
**********************************************
Hope it will help you .
Brgds,
Chhavinath
Mishra
Sr. Database Administrator
No comments:
Post a Comment