手机
当前位置:查字典教程网 >编程开发 >mssql数据库 >sqlserver查询某个字段在哪些表中存在
sqlserver查询某个字段在哪些表中存在
摘要:--含有医院编号字段的所有表selecta.[name]fromsysobjectsa,(select[id],count(*)bfroms...

--含有医院编号字段的所有表

select a.[name] from sysobjects a,

(

select [id],count(*) b from syscolumns

where [name] ='column1'

group by [id]

)

b where a.[id]=b.[id] order by a.name asc

--同时含有医院编号和科室编号字段的所有表

select a.[name] from sysobjects a

left join

(

select [id],count(*) b from syscolumns where [name]

in('column1','column2') group by [id] having count(*)>1

) b

on a.[id]=b.[id]

where b.id is not null

【sqlserver查询某个字段在哪些表中存在】相关文章:

sql条件查询+排序

sqlserver 中一些常看的指标和清除缓存的方法

sql server停止和重启命令

SQL Server数据库中的存储过程介绍

SQL Server 日志文件清理

SQLServer2005 的查询独占模拟

给sqlserver中的表创建索引

sql server中datetime字段去除时间的语句

Sqlserver2005日志文件太大如何减小

sqlserver中使用cmd命令注销如何登录用户

精品推荐
分类导航