为什么INFORMATION_SCHEMA.VIEW_TABLE_USAGE会给出不同的结果? [英] Why INFORMATION_SCHEMA.VIEW_TABLE_USAGE gives different result?

查看:130
本文介绍了为什么INFORMATION_SCHEMA.VIEW_TABLE_USAGE会给出不同的结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在两个类似的数据库(比如数据库1和数据库2)中有sql视图v_fsacc



CREATE VIEW [dbo]。[V_FSACC] AS SELECT fsacc .effdate,fsacc.dedfreq,fsacc.dedamt,fsacc.elect_yr,0.00 AS accrued,fsacc.perkey,fsacc.fsastat,bep.oemaxdlrs,fsacc.stopdate,fsacc.goalamt,fsacc.fsakey,bep.benplan,bep.borrowable ,0.00 AS as,fsacc.freq,fsacc.bepkey,fsacc.fsano,bep.plandesc FROM fsacc Fsacc,bep Bep WHERE Fsacc.bepkey = Bep.bepkey

GO





但是当我们运行以下查询

时,从INFORMATION_SCHEMA.VIEW_TABLE_USAGE中选择TABLE_NAME,其中VIEW_NAME ='V_FSACC'



在database1中它给出了bep以及fsacc表但在databse2中它只给出了bep表。

We have sql view v_fsacc as in two similar database(say database 1 and database 2) as

CREATE VIEW [dbo].[V_FSACC] AS SELECT fsacc.effdate, fsacc.dedfreq, fsacc.dedamt, fsacc.elect_yr, 0.00 AS accrued, fsacc.perkey, fsacc.fsastat, bep.oemaxdlrs, fsacc.stopdate, fsacc.goalamt, fsacc.fsakey, bep.benplan, bep.borrowable, 0.00 AS taken, fsacc.freq, fsacc.bepkey, fsacc.fsano, bep.plandesc FROM fsacc Fsacc, bep Bep WHERE Fsacc.bepkey = Bep.bepkey
GO


But when we ran the the following query
select TABLE_NAME from INFORMATION_SCHEMA.VIEW_TABLE_USAGE where VIEW_NAME='V_FSACC'

in database1 it gives bep as well as fsacc table but in databse2 it gives only bep table.

推荐答案

哪个数据库系统?如果是SQL Server,可能要查询: sys.sql_expression_dependencies 而不是?
Which database system? If SQL Server, maybe you want to query: sys.sql_expression_dependencies instead?


这篇关于为什么INFORMATION_SCHEMA.VIEW_TABLE_USAGE会给出不同的结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆