top of page

SQL find table on DB

  • Writer: skarbnik
    skarbnik
  • Nov 4, 2015
  • 1 min read

declare @table sysname, @SQL nvarchar(max)

set @table = 'TBL_APP_DID_BILLING_LINK'

set @SQL = ''

select @SQL = @SQL + ';

IF EXISTS (SELECT 1 from ' + QUOTENAME(name) + '.INFORMATION_SCHEMA.Tables WHERE Table_Name = @table)

PRINT ''Table ' + @table + ' found in ' + name + ''''

from sys.databases

execute sp_executeSQL @SQL, N'@table sysname', @table

Comments


Search By Tags
bottom of page