How to check if the table exists in a database in SQL Server ?

To check if the table exists in a database in SQL Server , you can use the INFORMATION_SCHEMA view.

How to check if the table exists in a database in SQL Server ?

Here’s a query that gets the table details of the table “Department” in the AdventureWorks2014 database.

use AdventureWorks2014
GO
SELECT * 
FROM INFORMATION_SCHEMA.TABLES 
WHERE TABLE_NAME = 'Department'


image

Leave a Reply