Youtube VR Indian Wanderers RSS Feed
Learn with Vikas Suhag
SQL Stored Procedure to Check Existence of Table in Database
Dec 08, 2021   Vikas Suhag
Microsoft SQL Server Tips and Tricks

//This stored procedure Return 'Flag' as 1/0 to mark presence/absence of table in database. It uses the database specified in connection string as host database.

create proc check_table_exist (@table_name varchar(500))
select 'Flag'=count(*) from sysobjects where type='U' and name=@table_name

SQL Server has sysobjects as the system table which contains the information about various objects in SQL Server.

Article By: Vikas Suhag

Leave a Comment

* Email will not be published.
All comments are only visible after approval.
Most Viewed articles
Subscribe to Email Updates
Vikas Suhag

I am Engineer, Developer, Teacher, Blogger, Vlogger, Traveller, Photographer...

I have been developing websites, writing blogs and recording videos during my travel while being a full tim ...

Youtube Channel
Subscribe to Email Updates
Connect With Us
Youtube VR Indian Wanderers RSS Feed
© 2022 Learn with Vikas Suhag. All Rights Reserved.