Filtering SQL sys.objects files by database

It should be easy, but I can’t get it.

I want to filter sys.objects results by database (name or id). I thought I needed to join sys.databases, but this seems impossible. I went to the SQL Servers docs, but did not find anything that could help.

What am I missing?

+4
source share
1 answer

Each database has its own sys.objects, so you need to get the databases from sys.databases and

select from {dbname}.sys.objects 

{dbname} is the name of sys.databases

+12
source

Source: https://habr.com/ru/post/1402194/


All Articles