query fail: SELECT cr.id, cr.name, cr.uk_region_id, ukr.name AS uk_region_name, cr.updated_at, cr.use_definite_article, ukr.use_definite_article uk_region_use_definite_article, cr.slug, pop_2019, fsm_idx, fsm_idx_ukr, tpr_idx, tpr_idx_ukr, sm_idx, (SELECT COUNT(*) FROM sch.dbo.combined_regions WHERE enabled = 1) AS n_regions, (SELECT COUNT(*) FROM sch.dbo.combined_regions cri WHERE cri.enabled = 1 AND cri.uk_region_id = cr.uk_region_id) AS n_regions_ukr , cr.envelope_center.STPointN(1).Lat AS centre_latitude, cr.envelope_center.STPointN(1).Long AS centre_longitude FROM sch.dbo.combined_regions cr WITH(NOLOCK) JOIN geo.dbo.uk_regions ukr WITH(NOLOCK) ON ukr.id = cr.uk_region_id WHERE cr.slug = ? AND enabled = 1 Array ( [0] => Array ( [0] => 08004 [SQLSTATE] => 08004 [1] => 916 [code] => 916 [2] => [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The server principal "sch" is not able to access the database "geo" under the current security context. [message] => [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The server principal "sch" is not able to access the database "geo" under the current security context. ) )