SQLServer常用SQL

一、基本常用

1)SQLServer数据库查询带有某个字段的所有表名:

(1)精确查询语句如下:

SELECT [name] FROM [库名].[dbo].sysobjects WHERE id IN (SELECT id FROM [库名].[dbo].syscolumns WHERE name = '字段名')

(2)模糊匹配查询

SELECT [name] FROM [库名].[dbo].sysobjects WHERE id IN (SELECT id FROM [库名].[dbo].syscolumns WHERE name LIKE '%字段名%')

你可能感兴趣的:(sql,sqlserver,oracle)