SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,293 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi, ALL,
Right now I'm using following query
SELECT object_id FROM sys.objects o, sys.schemas s WHERE s.schema_id = o.schema_id AND o.name = ? AND s.name = ?
Is there a simple way to bring in sys.databases table?
Thank you.
easy
SELECT object_id,apply1.* FROM sys.objects o, sys.schemas s cross apply(select * from sys.databases d where d.database_id = db_id())apply1 WHERE s.schema_id = o.schema_id AND o.name = ? AND s.name = ?