VR Indian Wanderers Youtube 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))
as
begin
select 'Flag'=count(*) from sysobjects where type='U' and name=@table_name
end

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


Leave a Comment

* Email will not be published.
All comments are only visible after approval.
Most Viewed articles
Travel Blog - VR Indian Wanderers
VR Indian Wanderers
Govt. Jobs Portal
Govt. Jobs Portal
Free Chart Maker
Make free animated Charts from .CSV
Search
Youtube Channel
Podcast
Subscribe to Email Updates
Connect With Us
VR Indian Wanderers Youtube RSS Feed
© 2024 Learn with Vikas Suhag. All Rights Reserved.