Stroed Procedure For Cheking Data base table exist or not in the Sqlserver


In this article, I will explain how to check the Sql Server Database For checking a Data Base Table name Exist or not..

Generally we are create database table with the some name.unfortunately if that table name exist sql server database gives some error table already exist.to avoid such problems. the below procedure use full ...

Create Procedure USP_CheckTAble
@tabname varchar(100)
As
Begin
IF EXISTS (SELECT 1
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE='BASE TABLE'
AND TABLE_NAME=@tabname)--Give your table name
SELECT 'tablename exists.'
ELSE
SELECT 'tablename does not exist.'
End


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: