MS_FOREACH

  • 724
  • 0

MS_FOREACH

exec model.sys.sp_MSforeachdb 
'USE [?]; 
select ''?'' db,name,rows,crdate from 
	(select distinct o.name, i.rows, o.crdate ,row_number() over(partition by o.name order by indid) rid
	from sys.sysobjects o inner join sys.sysindexes i on o.id = i.id
	where o.xtype=''U'') T
	where T.rid=1'