[dba-SQLServer] NEVERMIND (Fw: executing system stored procedure)

Martin Reid mwp.reid at qub.ac.uk
Tue Jan 13 14:24:28 CST 2009


Try this

Just lifted it of the web

use pubs
go 
create table #rowcount (tablename varchar(128), rowcnt int)
exec sp_MSforeachtable 
   'insert into #rowcount select ''?'', count(*) from ?'
select top 5 * from #rowcount
    order by tablename
drop table #rowcount





Martin


Martin WP Reid
Information Services
Queen's University
Riddel Hall
185 Stranmillis Road
Belfast
BT9 5EE
Tel : 02890974465
Email : mwp.reid at qub.ac.uk
________________________________________
From: dba-sqlserver-bounces at databaseadvisors.com [dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Susan Harkins [ssharkins at gmail.com]
Sent: 13 January 2009 20:20
To: SQLList
Subject: [dba-SQLServer] NEVERMIND (Fw: executing system stored procedure)

Was looking for

EXEC master..sp_MSForEachTable

Now, if I could just get it to work -- system finds the sp, but it doesn't
work as expected.

Susan H.


> USE database
> EXEC sys.sp_MSForEachTable command
>
> says it can't find the stored procedure -- I remember I had this problem
> once before, but I don't remember why. Any help? When I run it against
> master, I get a command successfully completed, not a "can't find"
> message, so it must be there.
>
> Susan H.

_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com



More information about the dba-SQLServer mailing list