RE: Record Counts for all Tables

RE: Record Counts for all Tables

 

  





Hi Sree,

Try this. It works with SQL7 using the isql utility at the command-line,
(don't enter the curly {} braces). The output file TestTableCounts.csv
should load directly into Excel. All the best.

isql -S{Server_Name} -U{Sql_Server_Login} -P{Sql_Server_Password} -s,
-Q"set nocount on select CAST((select count(*) from Database1..Table1) as
varchar) + ' records' as 'Table1', cast ((select count(*) from
Database2..Table2) as varchar) + ' records' as 'Table2', CAST((select
count(*) from Database3..Table3) as varchar) + ' records' as 'Table3' ,
cast ((select count(*) from Database4..Table4) as varchar) + ' records' as
'Table4' set nocount off" -o{full_path_of_Output_file}\TestTableCounts.csv
-w256

Regards,

Suresh




[Email Address Removed]
hosp.com.sg To: "LazyDBA.com Discussion" <[Email Address Removed]
cc:
22/10/2003 12:42 Subject: RE: Record Counts for all Tables







Hi Micael,

I need to automate the process to Excel sheet.. is there any way to do
that. and more over i only need to get row counts for specific tables only
not all.. please help.

Regards,
Sree.




"Michael Finley"

<[Email Address Removed] To: "LazyDBA.com
Discussion"
tions.com> <[Email Address Removed] cc:

10/22/2003 10:29 AM Subject: RE: Record
Counts for all Tables






Sree,

Use the attached stored proc to generate the number of recs and size and
paste into Excel. Once in excel, you can easily transform from the
columns to rows by copying the cells then using the "Paste Special" -
Transpose option.

Good luck,

Mike

http://www.SQLScriptSafe.com
Tool that Integrates VSS and SQL Server




-----Original Message-----
From: [Email Address Removed] Tuesday, October 21, 2003 8:56 PM
To: LazyDBA.com Discussion
Subject: Record Counts for all Tables

Friends,
need help again

I've some tables where i need to get all the Record counts of Specified
tables (or Sql Queries) and transfer them to an excel sheets like this..

tables

====================================================
table1 table2 table3 table4
====================================================
40 Recors 20 Records 38 Records 23 Records,
====================================================


Regards,
Sree.


---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Get today's cartoon: http://www.LazyDBA.com
To unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed] attached file: spGetTableRowCountAndSize.txt)
---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Get today's cartoon: http://www.LazyDBA.com
To unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed] REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Get today's cartoon: http://www.LazyDBA.com
To unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed]MS Sql Server LazyDBA home page