SQL Server 2016 - 按数据库名称获取 sys. assembly_files
我有一个数据库,其中添加了 .Net CLR 程序集。
当我通过选择该特定数据库执行以下查询时,我在结果中得到了程序集。
SELECT * FROM sys.assembly_files
但是,当我通过选择任何其他数据库(例如 master)执行上述相同的查询时,我没有在结果中得到程序集。
有没有办法通过选择主数据库并在具有程序集的查询中传递其他数据库名称来获取结果中的程序集?
I have a database that has a .Net CLR assembly added to it.
When I execute the below query by selecting that particular database, I get the assembly in the results.
SELECT * FROM sys.assembly_files
But when I execute the same above query by selecting any other database like master, I do not get the assembly in the results.
Is there any way to get the assembly in results by selecting the master database and passing the other database name in the query which has the assembly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
动态执行(或循环执行,或其他方式):
在手机上输入,如有任何拼写错误,敬请谅解。
You use
To do it dynamically (or in a loop, or whatever):
Entered on a phone, so sorry if any typos.
根据您想要执行的操作,这里有一些 powershell 将获取所有用户数据库中所有(非系统)程序集的所有文件的详细信息:
我正在使用
Connect-DbaInstance
from < a href="https://dbatools.io" rel="nofollow noreferrer">dbatools 来获取 SMO 服务器对象,但欢迎您按照自己的意愿进行操作。Depending on what you're trying to do, here's some powershell that will get the details for all files for all (non-system) assemblies in all user databases:
I'm using
Connect-DbaInstance
from dbatools to get an SMO Server object, but you're welcome to do that however you'd like.