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

Your email address will not be published. Required fields are marked *

You May Also Like

When dealing with a relational database management system (RDBMS) like SQL Server, compatibility level is an important concept to understand....
In this blog post, let’s learn about the error message “49975 – Unable to load controller client certificate due to...
In this blog post, let’s learn about the error message “49973 – Cannot remove tempdb remote file to local tempdb...