Home Forums SQL Server 2005 T-SQL (SS2K5) SELECT with a variable Tablename RE: SELECT with a variable Tablename
Bill Talada
SSChampion
Points: 11954
More actions
August 13, 2013 at 1:58 pm
#1641116
declare @TableName varchar(128);
set @TableName = 'sysdiagrams';
if exists
(
select i.rowcnt
from sys.tables t
join sys.sysindexes i on t.object_id = i.id
where indid in (1,0)
and t.name = @TableName
)
print 'yes'
;