There is a need that I need to create a query (T-Sql) where I will list the databases (name) given the elastic pool name. However, I couldn't find a sys.stats*** table or view that will give me this information , the simplest query I want to run is below but it could be any complex query as far as it gives me the list of dbs in an elastic pool
SELECT databaseName from sometable where elasticpoolname ='pool-1'
Answering my own question. I was able to manage list all dbs in a pool thru
SELECT
@@SERVERNAME as [ServerName],
dso.elastic_pool_name,
d.name as DatabaseName,
dso.edition
FROM
sys.databases d inner join sys.database_service_objectives dso on d.database_id = dso.database_id
WHERE d.Name <> 'master'
ORDER BY
d.name, dso.elastic_pool_name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With