I am working on a query right now that if i run it on a specific server it will tell me the name of all the databases on it as well as size of the database along with version of the particular app. I am stuck on syntax at the moment. Here is what I have. If I run this on the server I am able to return database name and size no problem of all databases on a server.
create table #dbsize (dbname varchar(50), dbsize decimal(10,2))
exec sp_MSforeachdb
'insert into #dbsize select ''?'', (0.0078125 * sum(size)/1024) from ?..sysfiles'
select * from #dbsize
order by dbname
drop table #dbsize
but now I want to include this as well
select AppVersion From dbo.GAppVersion where FK_GApp = 4
if i run that on a particular database it will tell me which version of an app it is running. Problem is I can only run it on each database one at a time. I want to include it in the above query so I can query all teh databases on a server at once. I want to somehow include this query in the above query to include it in the results for some reason either my syntax is incorrect or I am querying it wrong.
create table #dbsize (dbname varchar(50), dbsize decimal(10,2))
exec sp_MSforeachdb
'insert into #dbsize select ''?'', (0.0078125 * sum(size)/1024) from ?..sysfiles'
select * from #dbsize
order by dbname
drop table #dbsize
but now I want to include this as well
select AppVersion From dbo.GAppVersion where FK_GApp = 4
if i run that on a particular database it will tell me which version of an app it is running. Problem is I can only run it on each database one at a time. I want to include it in the above query so I can query all teh databases on a server at once. I want to somehow include this query in the above query to include it in the results for some reason either my syntax is incorrect or I am querying it wrong.