SqlServer查询空表
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)
网事随记
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)
SELECT LEFT('SqlServer_2008',3) 返回:Sql SELECT RIGHT('SqlServer_2008',4) 返回:2008 SELECT SUBSTRING('SqlServer_2008',4,6) 返回:Server
CnWizards 是 CnPack 项目组的主力产品之一,中文全称是 CnPack IDE 专家包, 英文全称是 CnPack IDE Wizards,简称 CnWizards。CnWizards 是一组集成在 Delphi/C++Builder/BDS 的 IDE 中,用于增强 IDE 功能、提高 ID
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
SELECT name FROM sysobjects WHERE id IN (SELECT id FROM syscolumns WHERE name = '字段名称') select [name] from [库名].[dbo].sysobjects where id in(select id from [库名].[dbo].syscolumns Where name='字段名')
V