In the code below, I am able to specify the table name and schema that I want to query with Table name and Table schema. How do I specify the database name and server name that I want to query?
I have tried DATABASE_NAME, DB_NAME and SERVER_NAME. None of them work.
SELECT COUNT(1) AS TABLECOUNT FROM INFORMATION_SCHEMA.TABLES WHERE
TABLE_SCHEMA = 'dbo' AND TABLE_NAME = '[TABLE_NAME]