GO
--============================================================ TEST START
declare @ScriptFileName varchar(2000)
-- get the script file name from the cmd shell
SELECT @ScriptFileName = '$(ScriptFileName)'
SELECT @ScriptFileName + ' --- TEST START ========================================='
declare @TableName varchar(200)
select @TableName = 'WriteHereTableName'
SELECT 'SELECT name from sys.tables where name =''MetaTable'''
SELECT name from sys.tables
where name = @TableName
DECLARE @TableCount INT
SELECT @TableCount = COUNT(name ) from sys.tables
where name =@TableName
if @TableCount=1
SELECT ' TEST PASSED. The Table ' + @TableName + ' EXISTS '
ELSE
SELECT ' TEST FAILED. The Table ' + @TableName + ' DOES NOT EXIST '
SELECT @ScriptFileName + ' --- TEST END ========================================='
--============================================================ TEST END
GO