what is the wrong with
insert into #tempA(MailSize)
EXEC sp_foreachdb_dev @command = N' USE ?
SELECT (size * 8)/1024.0 AS size_in_mb FROM
sys.database_files WHERE
data_space_id = 0',
@user_only = '开发者_开发百科1'
select * from #tempA
i want to store size of the log file in a temp table
Numerous problems:
- The procedure you want is
sp_msforeachdb
- That procedure takes parameter
@command1
- There is no
@user_only
parameter.
The version below works:
create table #tempA (
MailSize decimal
)
insert into #tempA(MailSize)
EXEC sp_msforeachdb
@command1 = N' USE ?
SELECT (size * 8)/1024.0 AS size_in_mb
FROM sys.database_files
WHERE data_space_id = 0'
select * from #tempA
drop table #tempA
精彩评论