sql 怎样从所有表中找出值为1.5的字段

来源:百度知道 编辑:UC知道 时间:2024/05/16 05:43:42
我想从数据库中的所有表中找出值为1.5的所有字段,请问sql语句应该如何写?
希望大家帮忙,谢谢!

获取所有表名:
select name from sysobjects where type='U'

获取所有字段名:
Select Name from SysColumns Where id=Object_Id('TableName')

select a from 1 where a='1.5'
union all
select b from 1 where b='1.5'
union all
select c from 2 where c='1.5'
union all
select d from 3 where d='1.5'
union all
select e from 3 where e='1.5'
union all
select f from 3 where f='1.5'