2021年3月10日星期三

Checking views and their default dependencies

Is it the default for a View to reference base tables in its own database in SQL Server Management Studio if it doesn't explicitly point to a specific database? I have tables with the same names across several databases on the same server and I'm not sure how to check which tables it's using. I used this query to see the Table_Catalog:

SELECT view_name, Table_Name,* FROM INFORMATION_SCHEMA.VIEW_TABLE_USAGE  

However I saw a warning that querying the sys.objects is the only way to really confirm the dependencies but I haven't been able to use any sys.objects queries because no rows return for some reason.

Appreciate any help. Thank you.

https://stackoverflow.com/questions/66576323/checking-views-and-their-default-dependencies March 11, 2021 at 12:06PM

没有评论:

发表评论