Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting row count as part of DB design info
Message
 
 
To
05/02/2008 09:22:46
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01289085
Message ID:
01289517
Views:
16
>I tried the following, but I think the the sp still looks at the tables from the current DB. I can insert the results from the original version into the temp table, then into another table. I was just trying to find a way to do it in one command.
>
>use MyDesignDB
>go
>create table tRowCount (tablename varchar(128), rowcnt int)
>exec sp_MSforeachtable
>   'insert into tRowCount select 'MyTestDB.' + ''?'', count(*) from 'MyTestDB.' + ?'
>select * from tRowCount
>    order by rowcnt, tablename
>
Looks like you would not be able to do it. In my tries I was getting

Could not find server 'Database name' in sysservers. Execute sp_addlinkedserver to add the server to sysservers.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform