SELECT schema_name(t.schema_id) AS [Schema], t.name AS TableName, i.rows AS [RowCount] FROM sys.tables AS t INNER JOIN sys.sysindexes AS i ON t.object_id = i.id WHERE (i.indid <= 1) AND (i.rows = 0)

SqlServer 查询空表

Read more

set @str='test' --要搜索的字符串 declare @s varchar(8000) declare tb cursor local for select s='if exists(select 1 from ['+b.name+'] where ['+a.name+'] like ''%'+@str+'%'') print ''所在的表及字段: ['+b.name+'].['+a.name+']''' from syscolumns a join sysobjects b on a.id=b.id

SqlServer

Read more

V