Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
kouliscon
Starting Member
7 Posts |
Posted - 2011-08-02 : 06:56:30
|
HelloI am doing backup of SQL to a network locaion and i need an sql command to return me the size of DB per table now, and then i will make a backup. Restore and run again the same sql command. By that i verify that the backup and restore was succesfull. DB is not in use by anyone. thxKostas |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-02 : 07:36:13
|
do you mean split up of size based on tables?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
kouliscon
Starting Member
7 Posts |
Posted - 2011-08-02 : 07:48:27
|
HelloNo i dont mean that.DB1 is at server1.I run BACKUP at a network location1.I run sql script which returns that size of table1=1000rows, table2=2000rows....etcI do restore i run script again.i compare between 2 results.just to be sure i want it.thxKostas |
 |
|
Sachin.Nand
2937 Posts |
Posted - 2011-08-02 : 08:05:01
|
This ?declare @t table(TableName varchar(300),Count int)insert @texec sp_msforeachtable 'select ''?'',count(*) from ?'select * from @t order by TableName PBUH |
 |
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2011-08-02 : 12:19:13
|
There is also "exec sp_spaceused 'MyTable'" which would be faster though potentially less accurate. In a quiescent setting, such as you would find in the environment you describe, sp_spaceused should be accurate.=======================================I have never met a man so ignorant that I couldn't learn something from him. -Galileo Galilei, physicist and astronomer (1564-1642) |
 |
|
|
|
|